Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libm / mathfp / s_ceil.c
blob29e4a059d1296a1178d6f7d1efddf5b0c91869f3
2 /* @(#)z_ceil.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 #ifndef _DOUBLE_IS_32BITS
22 double
23 ceil (double x)
25 double f, y;
27 y = modf (x, &f);
29 if (y == 0.0)
30 return (x);
31 else if (x > -1.0 && x < 1.0)
32 return (x > 0 ? 1.0 : 0.0);
33 else
34 return (x > 0 ? f + 1.0 : f);
37 #endif /* _DOUBLE_IS_32BITS */