2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libf2c / libF77 / cabs.c
blob5d2142e1825c61f8ecfc9a22639efb0244d27b05
1 #undef abs
2 #include <math.h>
3 double
4 f__cabs (double real, double imag)
6 double temp;
8 if (real < 0)
9 real = -real;
10 if (imag < 0)
11 imag = -imag;
12 if (imag > real)
14 temp = real;
15 real = imag;
16 imag = temp;
18 if ((real + imag) == real)
19 return (real);
21 temp = imag / real;
22 temp = real * sqrt (1.0 + temp * temp); /*overflow!! */
23 return (temp);