2 /* @(#)z_floor.c 1.0 98/08/13 */
6 <<floor>>, <<floorf>>, <<ceil>>, <<ceilf>>---floor and ceiling
18 double floor(double <[x]>);
19 float floorf(float <[x]>);
20 double ceil(double <[x]>);
21 float ceilf(float <[x]>);
24 <<floor>> and <<floorf>> find
28 the nearest integer less than or equal to <[x]>.
29 <<ceil>> and <<ceilf>> find
33 the nearest integer greater than or equal to <[x]>.
36 <<floor>> and <<ceil>> return the integer result as a double.
37 <<floorf>> and <<ceilf>> return the integer result as a float.
40 <<floor>> and <<ceil>> are ANSI.
41 <<floorf>> and <<ceilf>> are extensions.
45 /*****************************************************************
49 * x - floating point value
52 * Smallest integer less than x.
55 * This routine returns the smallest integer less than x.
57 *****************************************************************/
62 #ifndef _DOUBLE_IS_32BITS
69 if (x
> -1.0 && x
< 1.0)
70 return (x
>= 0 ? 0 : -1.0);
77 return (x
>= 0 ? f
: f
- 1.0);
80 #endif /* _DOUBLE_IS_32BITS */