add -f on mv for Version
[unix-history] / usr / src / usr.bin / f77 / libF77 / cabs.c
CommitLineData
af189a9d 1/*
b33b37cf
RE
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 *
6 * @(#)cabs.c 5.1 %G%
af189a9d
DW
7 */
8
9double cabs(real, imag)
10double real, imag;
11{
12double temp, sqrt();
13
14if(real < 0)
15 real = -real;
16if(imag < 0)
17 imag = -imag;
18if(imag > real){
19 temp = real;
20 real = imag;
21 imag = temp;
22}
23if((real+imag) == real)
24 return(real);
25
26temp = imag/real;
27temp = real*sqrt(1.0 + temp*temp); /*overflow!!*/
28return(temp);
29}