Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libm / mathfp / sf_floor.c
blob4ba295139c72407ca1d70a7e8147267db5e3347f
2 /* @(#)z_floorf.c 1.0 98/08/13 */
3 /*****************************************************************
4 * floor
6 * Input:
7 * x - floating point value
9 * Output:
10 * Smallest integer less than x.
12 * Description:
13 * This routine returns the smallest integer less than x.
15 *****************************************************************/
17 #include "fdlibm.h"
18 #include "zmath.h"
20 float
21 floorf (float x)
23 float f, y;
25 if (x > -1.0 && x < 1.0)
26 return (x >= 0 ? 0 : -1.0);
28 y = modff (x, &f);
30 if (y == 0.0)
31 return (x);
33 return (x >= 0 ? f : f - 1.0);
36 #ifdef _DOUBLE_IS_32BITS
37 double floor (double x)
39 return (double) floorf ((float) x);
42 #endif /* defined(_DOUBLE_IS_32BITS) */