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]>);
35 <<floor>> and <<floorf>> find
39 the nearest integer less than or equal to <[x]>.
40 <<ceil>> and <<ceilf>> find
44 the nearest integer greater than or equal to <[x]>.
47 <<floor>> and <<ceil>> return the integer result as a double.
48 <<floorf>> and <<ceilf>> return the integer result as a float.
51 <<floor>> and <<ceil>> are ANSI.
52 <<floorf>> and <<ceilf>> are extensions.
56 /*****************************************************************
60 * x - floating point value
63 * Smallest integer less than x.
66 * This routine returns the smallest integer less than x.
68 *****************************************************************/
73 #ifndef _DOUBLE_IS_32BITS
76 _DEFUN (floor
, (double),
81 if (x
> -1.0 && x
< 1.0)
82 return (x
>= 0 ? 0 : -1.0);
89 return (x
>= 0 ? f
: f
- 1.0);
92 #endif /* _DOUBLE_IS_32BITS */