blob: 5d2142e1825c61f8ecfc9a22639efb0244d27b05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#undef abs
#include <math.h>
double
f__cabs (double real, double imag)
{
double temp;
if (real < 0)
real = -real;
if (imag < 0)
imag = -imag;
if (imag > real)
{
temp = real;
real = imag;
imag = temp;
}
if ((real + imag) == real)
return (real);
temp = imag / real;
temp = real * sqrt (1.0 + temp * temp); /*overflow!! */
return (temp);
}
|