Query: fabs
OS: bsd
Section: 3m
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
FLOOR(3M) FLOOR(3M)NAMEfabs, floor, ceil, rint - absolute value, floor, ceiling, and round-to-nearest functionsSYNOPSIS#include <math.h> double floor(x) double x; double ceil(x) double x; double fabs(x) double x; double rint(x) double x;DESCRIPTIONFabs returns the absolute value |x|. Floor returns the largest integer no greater than x. Ceil returns the smallest integer no less than x. Rint returns the integer (represented as a double precision number) nearest x in the direction of the prevailing rounding mode.NOTESOn a VAX, rint(x) is equivalent to adding half to the magnitude and then rounding towards zero. In the default rounding mode, to nearest, on a machine that conforms to IEEE 754, rint(x) is the integer nearest x with the additional stipulation that if |rint(x)-x|=1/2 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) double x; int k; k = x; Most C compilers round x towards 0 to get the integer k, but some do otherwise. If in doubt, use floor, ceil, or rint first, whichever you intend. Also note that, if x is larger than k can accommodate, the value of k and the presence or absence of an integer overflow are hard to predict.SEE ALSOabs(3), ieee(3M), math(3M) 4th Berkeley Distribution May 12, 1986 FLOOR(3M)
Related Man Pages |
---|
rint(3m) - bsd |
fabs(3m) - bsd |
ceil(3m) - ultrix |
rint(3m) - sunos |
rintf(3m) - sunos |
Similar Topics in the Unix Linux Community |
---|
double dashes |
Java double subtraction oddity (not the usual rounding discrepancy) |
How to round up on fives in unix? |
CEILING and FLOOR functions |
Ceil not working as function in awk statement |