Merge from vendor branch GCC:
[dragonfly.git] / contrib / gcc-3.4 / libf2c / libF77 / cabs.c
1 #undef abs
2 #include <math.h>
3 double
4 f__cabs (double real, double imag)
5 {
6   double temp;
7
8   if (real < 0)
9     real = -real;
10   if (imag < 0)
11     imag = -imag;
12   if (imag > real)
13     {
14       temp = real;
15       real = imag;
16       imag = temp;
17     }
18   if ((real + imag) == real)
19     return (real);
20
21   temp = imag / real;
22   temp = real * sqrt (1.0 + temp * temp);       /*overflow!! */
23   return (temp);
24 }