home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 2
/
goldfish_vol2_cd2.bin
/
bbs
/
gnu
/
f2c-1993.04.28-src.lha
/
GNU
/
src
/
amiga
/
f2c-1993.04.28
/
libF77
/
cabs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-04-28
|
427b
|
28 lines
#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 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);
}