Commit | Line | Data |
---|---|---|
0c9e74ab TL |
1 | double cabs(real, imag) |
2 | double real, imag; | |
3 | { | |
4 | double temp, sqrt(); | |
5 | ||
6 | if(real < 0) | |
7 | real = -real; | |
8 | if(imag < 0) | |
9 | imag = -imag; | |
10 | if(imag > real){ | |
11 | temp = real; | |
12 | real = imag; | |
13 | imag = temp; | |
14 | } | |
15 | if((real+imag) == real) | |
16 | return(real); | |
17 | ||
18 | temp = imag/real; | |
19 | temp = real*sqrt(1.0 + temp*temp); /*overflow!!*/ | |
20 | return(temp); | |
21 | } |