Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libm / mathfp / sf_fabs.c
blob8ee93b162a0fe26f36cfe9ab89e50da8f54c3a68
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 fabsf (float x)
23 switch (numtestf (x))
25 case NAN:
26 errno = EDOM;
27 return (x);
28 case INF:
29 errno = ERANGE;
30 return (x);
31 case 0:
32 return (0.0);
33 default:
34 return (x < 0.0 ? -x : x);
38 #ifdef _DOUBLE_IS_32BITS
39 double fabs (double x)
41 return (double) fabsf ((float) x);
44 #endif /* defined(_DOUBLE_IS_32BITS) */