|
|
1.1 root 1: /*
2: * "@(#)cabs.c 1.1"
3: */
4:
5: double cabs(real, imag)
6: double real, imag;
7: {
8: double temp, sqrt();
9:
10: if(real < 0)
11: real = -real;
12: if(imag < 0)
13: imag = -imag;
14: if(imag > real){
15: temp = real;
16: real = imag;
17: imag = temp;
18: }
19: if((real+imag) == real)
20: return(real);
21:
22: temp = imag/real;
23: temp = real*sqrt(1.0 + temp*temp); /*overflow!!*/
24: return(temp);
25: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.