home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_09_07
/
9n07014a
< prev
next >
Wrap
Text File
|
1991-05-23
|
336b
|
22 lines
/* fabs function */
#include "xmath.h"
double (fabs)(double x)
{ /* compute fabs */
switch (_Dtest(&x))
{ /* test for special codes */
case NAN:
errno = EDOM;
return (x);
case INF:
errno = ERANGE;
return (_Inf._D);
case 0:
return (0.0);
default: /* finite */
return (x 0.0 ? -x : x);
}
}