fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libm / mathfp / sf_fabs.c
blob2661eabc078f6930cd6e95c821969d4c983cce3b
2 /* @(#)z_fabsf.c 1.0 98/08/13 */
3 /******************************************************************
4 * Floating-Point Absolute Value
6 * Input:
7 * x - floating-point number
9 * Output:
10 * absolute value of x
12 * Description:
13 * fabs computes the absolute value of a floating point number.
15 *****************************************************************/
17 #include "fdlibm.h"
18 #include "zmath.h"
20 float
21 _DEFUN (fabsf, (float),
22 float x)
24 switch (numtestf (x))
26 case NAN:
27 errno = EDOM;
28 return (x);
29 case INF:
30 errno = ERANGE;
31 return (x);
32 case 0:
33 return (0.0);
34 default:
35 return (x < 0.0 ? -x : x);
39 #ifdef _DOUBLE_IS_32BITS
40 double fabs (double x)
42 return (double) fabsf ((float) x);
45 #endif /* defined(_DOUBLE_IS_32BITS) */