1floor(3)                   Library Functions Manual                   floor(3)
2
3
4

NAME

6       floor,  floorf,  floorl - largest integral value not greater than argu‐
7       ment
8

LIBRARY

10       Math library (libm, -lm)
11

SYNOPSIS

13       #include <math.h>
14
15       double floor(double x);
16       float floorf(float x);
17       long double floorl(long double x);
18
19   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
20
21       floorf(), floorl():
22           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
23               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
24               || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
25

DESCRIPTION

27       These functions return the largest integral value that is  not  greater
28       than x.
29
30       For example, floor(0.5) is 0.0, and floor(-0.5) is -1.0.
31

RETURN VALUE

33       These functions return the floor of x.
34
35       If x is integral, +0, -0, NaN, or an infinity, x itself is returned.
36

ERRORS

38       No  errors  occur.  POSIX.1-2001 documents a range error for overflows,
39       but see NOTES.
40

ATTRIBUTES

42       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
43       tributes(7).
44
45       ┌────────────────────────────────────────────┬───────────────┬─────────┐
46Interface                                   Attribute     Value   
47       ├────────────────────────────────────────────┼───────────────┼─────────┤
48floor(), floorf(), floorl()                 │ Thread safety │ MT-Safe │
49       └────────────────────────────────────────────┴───────────────┴─────────┘
50

STANDARDS

52       C11, POSIX.1-2008.
53

HISTORY

55       C99, POSIX.1-2001.
56
57       The variant returning double also conforms to SVr4, 4.3BSD, C89.
58
59       SUSv2 and POSIX.1-2001 contain text about overflow (which might set er‐
60       rno to ERANGE, or raise an FE_OVERFLOW exception).   In  practice,  the
61       result  cannot  overflow on any current machine, so this error-handling
62       stuff is just nonsense.  (More precisely, overflow can happen only when
63       the maximum value of the exponent is smaller than the number of mantis‐
64       sa bits.  For the IEEE-754 standard 32-bit  and  64-bit  floating-point
65       numbers  the maximum value of the exponent is 127 (respectively, 1023),
66       and the number of mantissa bits including the implicit bit is  24  (re‐
67       spectively, 53).)
68

SEE ALSO

70       ceil(3), lrint(3), nearbyint(3), rint(3), round(3), trunc(3)
71
72
73
74Linux man-pages 6.04              2023-03-30                          floor(3)
Impressum