4.3BSD beta release version
[unix-history] / usr / src / usr.bin / f77 / libF77 / cabs.c
CommitLineData
af189a9d
DW
1/*
2 * "@(#)cabs.c 1.1"
3 */
4
5double cabs(real, imag)
6double real, imag;
7{
8double temp, sqrt();
9
10if(real < 0)
11 real = -real;
12if(imag < 0)
13 imag = -imag;
14if(imag > real){
15 temp = real;
16 real = imag;
17 imag = temp;
18}
19if((real+imag) == real)
20 return(real);
21
22temp = imag/real;
23temp = real*sqrt(1.0 + temp*temp); /*overflow!!*/
24return(temp);
25}