Manual page for FLOOR(3M)
fabs, floor, ceil - absolute value, floor, and ceiling functions
double floor(double x);
double ceil(double x);
double fabs(double x);
(ALSO AVAILABLE IN BSD)
double rint(double x);
returns the absolute value |x|.
returns the largest integer no greater than x.
returns the smallest integer no less than x.
returns the integer (represented as a double precision number)
nearest x in the direction of the prevailing rounding mode.
In the default rounding mode, to nearest,
on a machine that conforms to IEEE 754,
is the integer nearest
with the additional stipulation
then rint(x) is even.
Other rounding modes can make rint act like floor, or like ceil,
or round towards zero.
Another way to obtain an integer near x is to declare (in C):
Most C compilers round x towards 0 to get the integer k, but
some do otherwise.
If in doubt, use
first, whichever you intend.
Also note that, if x is larger than k can accommodate,
the value of
and the presence or absence of an integer overflow are hard to
double x; int k; k = x;
Created by unroff & hp-tools.
© by Hans-Peter Bischof. All Rights Reserved (1997).
Last modified 21/April/97