fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libm / mathfp / sf_ceil.c
blobbc8e1403b3d80c116bb808ad0ff766dd4fb065ae
2 /* @(#)z_ceilf.c 1.0 98/08/13 */
3 /*****************************************************************
4 * ceil
6 * Input:
7 * x - floating point value
9 * Output:
10 * Smallest integer greater than x.
12 * Description:
13 * This routine returns the smallest integer greater than x.
15 *****************************************************************/
17 #include "fdlibm.h"
18 #include "zmath.h"
20 float
21 _DEFUN (ceilf, (float),
22 float x)
24 float f, y;
26 y = modff (x, &f);
28 if (y == 0.0)
29 return (x);
30 else if (x > -1.0 && x < 1.0)
31 return (x > 0 ? 1.0 : 0.0);
32 else
33 return (x > 0 ? f + 1.0 : f);
36 #ifdef _DOUBLE_IS_32BITS
37 double ceil (double x)
39 return (double) ceilf ((float) x);
42 #endif /* defined(_DOUBLE_IS_32BITS) */