]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/floor.3
perf_event_open.2: srcfix
[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 2016-03-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 .sp
34 .BI "double floor(double " x );
35 .br
36 .BI "float floorf(float " x );
37 .br
38 .BI "long double floorl(long double " x );
39 .fi
40 .sp
41 Link with \fI\-lm\fP.
42 .sp
43 .in -4n
44 Feature Test Macro Requirements for glibc (see
45 .BR feature_test_macros (7)):
46 .in
47 .sp
48 .ad l
49 .BR floorf (),
50 .BR floorl ():
51 .RS 4
52 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
53 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
54 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
55 .RE
56 .ad
57 .SH DESCRIPTION
58 These functions return the largest integral value that is not greater than
59 .IR x .
60
61 For example,
62 .IR floor(0.5)
63 is 0.0, and
64 .IR floor(\-0.5)
65 is \-1.0.
66 .SH RETURN VALUE
67 These functions return the floor of
68 .IR x .
69
70 If
71 .I x
72 is integral, +0, \-0, NaN, or an infinity,
73 .I x
74 itself is returned.
75 .SH ERRORS
76 No errors occur.
77 POSIX.1-2001 documents a range error for overflows, but see NOTES.
78 .SH ATTRIBUTES
79 For an explanation of the terms used in this section, see
80 .BR attributes (7).
81 .TS
82 allbox;
83 lbw27 lb lb
84 l l l.
85 Interface Attribute Value
86 T{
87 .BR floor (),
88 .BR floorf (),
89 .BR floorl ()
90 T} Thread safety MT-Safe
91 .TE
92 .SH CONFORMING TO
93 C99, POSIX.1-2001, POSIX.1-2008.
94
95 The variant returning
96 .I double
97 also conforms to
98 SVr4, 4.3BSD, C89.
99 .SH NOTES
100 SUSv2 and POSIX.1-2001 contain text about overflow (which might set
101 .I errno
102 to
103 .BR ERANGE ,
104 or raise an
105 .B FE_OVERFLOW
106 exception).
107 In practice, the result cannot overflow on any current machine,
108 so this error-handling stuff is just nonsense.
109 .\" The POSIX.1-2001 APPLICATION USAGE SECTION discusses this point.
110 (More precisely, overflow can happen only when the maximum value
111 of the exponent is smaller than the number of mantissa bits.
112 For the IEEE-754 standard 32-bit and 64-bit floating-point numbers
113 the maximum value of the exponent is 128 (respectively, 1024),
114 and the number of mantissa bits is 24 (respectively, 53).)
115 .SH SEE ALSO
116 .BR ceil (3),
117 .BR lrint (3),
118 .BR nearbyint (3),
119 .BR rint (3),
120 .BR round (3),
121 .BR trunc (3)