fixed more binutils issues (newer gcc/libc)
[zpugcc/jano.git] / toolchain / gcc / newlib / libm / mathfp / sf_floor.c
blob1e0fb9e449633f9271c2463aa31ffb04477fbda2
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 _DEFUN (floorf, (float),
22 float x)
24 float f, y;
26 if (x > -1.0 && x < 1.0)
27 return (x >= 0 ? 0 : -1.0);
29 y = modff (x, &f);
31 if (y == 0.0)
32 return (x);
34 return (x >= 0 ? f : f - 1.0);
37 #ifdef _DOUBLE_IS_32BITS
38 double floor (double x)
40 return (double) floorf ((float) x);
43 #endif /* defined(_DOUBLE_IS_32BITS) */