share/mk/: build-html: Don't build mbind.2 and set_mempolicy.2
[man-pages.git] / man3 / floor.3
blob2df4489ba0a74309696acd337403ddd1f7758451
1 '\" t
2 .\" Copyright 2001 Andries Brouwer <aeb@cwi.nl>.
3 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4 .\"     <mtk.manpages@gmail.com>
5 .\"
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .\"
8 .TH floor 3 (date) "Linux man-pages (unreleased)"
9 .SH NAME
10 floor, floorf, floorl \- largest integral value not greater than argument
11 .SH LIBRARY
12 Math library
13 .RI ( libm ", " \-lm )
14 .SH SYNOPSIS
15 .nf
16 .B #include <math.h>
18 .BI "double floor(double " x );
19 .BI "float floorf(float " x );
20 .BI "long double floorl(long double " x );
21 .fi
23 .RS -4
24 Feature Test Macro Requirements for glibc (see
25 .BR feature_test_macros (7)):
26 .RE
28 .BR floorf (),
29 .BR floorl ():
30 .nf
31     _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
32         || /* Since glibc 2.19: */ _DEFAULT_SOURCE
33         || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
34 .fi
35 .SH DESCRIPTION
36 These functions return the largest integral value that is not greater than
37 .IR x .
39 For example,
40 .I floor(0.5)
41 is 0.0, and
42 .I floor(\-0.5)
43 is \-1.0.
44 .SH RETURN VALUE
45 These functions return the floor of
46 .IR x .
49 .I x
50 is integral, +0, \-0, NaN, or an infinity,
51 .I x
52 itself is returned.
53 .SH ERRORS
54 No errors occur.
55 POSIX.1-2001 documents a range error for overflows, but see NOTES.
56 .SH ATTRIBUTES
57 For an explanation of the terms used in this section, see
58 .BR attributes (7).
59 .TS
60 allbox;
61 lbx lb lb
62 l l l.
63 Interface       Attribute       Value
65 .na
66 .nh
67 .BR floor (),
68 .BR floorf (),
69 .BR floorl ()
70 T}      Thread safety   MT-Safe
71 .TE
72 .SH STANDARDS
73 C11, POSIX.1-2008.
74 .SH HISTORY
75 C99, POSIX.1-2001.
77 The variant returning
78 .I double
79 also conforms to
80 SVr4, 4.3BSD, C89.
82 SUSv2 and POSIX.1-2001 contain text about overflow (which might set
83 .I errno
85 .BR ERANGE ,
86 or raise an
87 .B FE_OVERFLOW
88 exception).
89 In practice, the result cannot overflow on any current machine,
90 so this error-handling stuff is just nonsense.
91 .\" The POSIX.1-2001 APPLICATION USAGE SECTION discusses this point.
92 (More precisely, overflow can happen only when the maximum value
93 of the exponent is smaller than the number of mantissa bits.
94 For the IEEE-754 standard 32-bit and 64-bit floating-point numbers
95 the maximum value of the exponent is 127 (respectively, 1023),
96 and the number of mantissa bits
97 including the implicit bit
98 is 24 (respectively, 53).)
99 .SH SEE ALSO
100 .BR ceil (3),
101 .BR lrint (3),
102 .BR nearbyint (3),
103 .BR rint (3),
104 .BR round (3),
105 .BR trunc (3)