1FLOOR(3) Linux Programmer's Manual FLOOR(3)
2
3
4
6 floor, floorf, floorl - largest integral value not greater than argu‐
7 ment
8
10 #include <math.h>
11
12 double floor(double x);
13 float floorf(float x);
14 long double floorl(long double x);
15
16 Link with -lm.
17
19 These functions round x down to the nearest integer.
20
22 The rounded integer value. If x is integral or infinite, x itself is
23 returned.
24
26 No errors other than EDOM and ERANGE can occur. If x is NaN, then NaN
27 is returned and errno may be set to EDOM.
28
30 SUSv2 and POSIX.1-2001 contain text about overflow (which might set
31 errno to ERANGE, or raise an exception). In practice, the result can‐
32 not overflow on any current machine, so this error-handling stuff is
33 just nonsense. (More precisely, overflow can happen only when the max‐
34 imum value of the exponent is smaller than the number of mantissa bits.
35 For the IEEE-754 standard 32-bit and 64-bit floating point numbers the
36 maximum value of the exponent is 128 (resp. 1024), and the number of
37 mantissa bits is 24 (resp. 53).)
38
40 The floor() function conforms to SVr4, 4.3BSD, C89. The other func‐
41 tions are from C99.
42
44 ceil(3), lrint(3), nearbyint(3), rint(3), round(3), trunc(3)
45
46
47
48 2001-05-31 FLOOR(3)