1998-02-01 02:37:08 +01:00
|
|
|
#undef abs
|
|
|
|
#include <math.h>
|
2002-06-01 14:38:32 +02:00
|
|
|
double
|
|
|
|
f__cabs (double real, double imag)
|
1998-02-01 02:37:08 +01:00
|
|
|
{
|
2002-06-01 14:38:32 +02:00
|
|
|
double temp;
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
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);
|
1998-02-01 02:37:08 +01:00
|
|
|
|
2002-06-01 14:38:32 +02:00
|
|
|
temp = imag / real;
|
|
|
|
temp = real * sqrt (1.0 + temp * temp); /*overflow!! */
|
|
|
|
return (temp);
|
1998-02-01 02:37:08 +01:00
|
|
|
}
|