]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/floor.3
dlopen.3: tfix
[thirdparty/man-pages.git] / man3 / floor.3
1 .\" Copyright 2001 Andries Brouwer <aeb@cwi.nl>.
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
4 .\"
5 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .TH FLOOR 3 2017-09-15 "" "Linux Programmer's Manual"
28 .SH NAME
29 floor, floorf, floorl \- largest integral value not greater than argument
30 .SH SYNOPSIS
31 .nf
32 .B #include <math.h>
33 .PP
34 .BI "double floor(double " x );
35 .BI "float floorf(float " x );
36 .BI "long double floorl(long double " x );
37 .fi
38 .PP
39 Link with \fI\-lm\fP.
40 .PP
41 .in -4n
42 Feature Test Macro Requirements for glibc (see
43 .BR feature_test_macros (7)):
44 .in
45 .PP
46 .ad l
47 .BR floorf (),
48 .BR floorl ():
49 .RS 4
50 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
51 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
52 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
53 .RE
54 .ad
55 .SH DESCRIPTION
56 These functions return the largest integral value that is not greater than
57 .IR x .
58 .PP
59 For example,
60 .IR floor(0.5)
61 is 0.0, and
62 .IR floor(\-0.5)
63 is \-1.0.
64 .SH RETURN VALUE
65 These functions return the floor of
66 .IR x .
67 .PP
68 If
69 .I x
70 is integral, +0, \-0, NaN, or an infinity,
71 .I x
72 itself is returned.
73 .SH ERRORS
74 No errors occur.
75 POSIX.1-2001 documents a range error for overflows, but see NOTES.
76 .SH ATTRIBUTES
77 For an explanation of the terms used in this section, see
78 .BR attributes (7).
79 .TS
80 allbox;
81 lbw27 lb lb
82 l l l.
83 Interface Attribute Value
84 T{
85 .BR floor (),
86 .BR floorf (),
87 .BR floorl ()
88 T} Thread safety MT-Safe
89 .TE
90 .SH CONFORMING TO
91 C99, POSIX.1-2001, POSIX.1-2008.
92 .PP
93 The variant returning
94 .I double
95 also conforms to
96 SVr4, 4.3BSD, C89.
97 .SH NOTES
98 SUSv2 and POSIX.1-2001 contain text about overflow (which might set
99 .I errno
100 to
101 .BR ERANGE ,
102 or raise an
103 .B FE_OVERFLOW
104 exception).
105 In practice, the result cannot overflow on any current machine,
106 so this error-handling stuff is just nonsense.
107 .\" The POSIX.1-2001 APPLICATION USAGE SECTION discusses this point.
108 (More precisely, overflow can happen only when the maximum value
109 of the exponent is smaller than the number of mantissa bits.
110 For the IEEE-754 standard 32-bit and 64-bit floating-point numbers
111 the maximum value of the exponent is 128 (respectively, 1024),
112 and the number of mantissa bits is 24 (respectively, 53).)
113 .SH SEE ALSO
114 .BR ceil (3),
115 .BR lrint (3),
116 .BR nearbyint (3),
117 .BR rint (3),
118 .BR round (3),
119 .BR trunc (3)