Bell 32V development
[unix-history] / usr / src / libF77 / cabs.c
CommitLineData
0c9e74ab
TL
1double cabs(real, imag)
2double real, imag;
3{
4double temp, sqrt();
5
6if(real < 0)
7 real = -real;
8if(imag < 0)
9 imag = -imag;
10if(imag > real){
11 temp = real;
12 real = imag;
13 imag = temp;
14}
15if((real+imag) == real)
16 return(real);
17
18temp = imag/real;
19temp = real*sqrt(1.0 + temp*temp); /*overflow!!*/
20return(temp);
21}