diff options
Diffstat (limited to 'contrib/libf2c/libF77/cabs.c')
-rw-r--r-- | contrib/libf2c/libF77/cabs.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/contrib/libf2c/libF77/cabs.c b/contrib/libf2c/libF77/cabs.c index 2fad044..5d2142e 100644 --- a/contrib/libf2c/libF77/cabs.c +++ b/contrib/libf2c/libF77/cabs.c @@ -1,27 +1,24 @@ -#ifdef KR_headers -extern double sqrt(); -double f__cabs(real, imag) double real, imag; -#else #undef abs #include <math.h> -double f__cabs(double real, double imag) -#endif +double +f__cabs (double real, double imag) { -double temp; + 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); + 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); + temp = imag / real; + temp = real * sqrt (1.0 + temp * temp); /*overflow!! */ + return (temp); } |