Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libm / mathfp / sf_ceil.c
blob51ddada1f749bbdd6677ac298b8d2433204c1de7
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 ceilf (float x)
23 float f, y;
25 y = modff (x, &f);
27 if (y == 0.0)
28 return (x);
29 else if (x > -1.0 && x < 1.0)
30 return (x > 0 ? 1.0 : 0.0);
31 else
32 return (x > 0 ? f + 1.0 : f);
35 #ifdef _DOUBLE_IS_32BITS
36 double ceil (double x)
38 return (double) ceilf ((float) x);
41 #endif /* defined(_DOUBLE_IS_32BITS) */