1 .\" Copyright 2001 Andries Brouwer <aeb@cwi.nl>.
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .TH CEIL 3 2021-03-22 GNU "Linux Programmer's Manual"
9 ceil, ceilf, ceill \- ceiling function: smallest integral value not
13 .RI ( libm ", " \-lm )
18 .BI "double ceil(double " x );
19 .BI "float ceilf(float " x );
20 .BI "long double ceill(long double " x );
24 Feature Test Macro Requirements for glibc (see
25 .BR feature_test_macros (7)):
31 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
32 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
33 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
36 These functions return the smallest integral value that is not less than
45 These functions return the ceiling of
50 is integral, +0, \-0, NaN, or infinite,
55 POSIX.1-2001 documents a range error for overflows, but see NOTES.
57 For an explanation of the terms used in this section, see
65 Interface Attribute Value
70 T} Thread safety MT-Safe
76 C99, POSIX.1-2001, POSIX.1-2008.
83 SUSv2 and POSIX.1-2001 contain text about overflow (which might set
90 In practice, the result cannot overflow on any current machine,
91 so this error-handling stuff is just nonsense.
92 .\" The POSIX.1-2001 APPLICATION USAGE SECTION discusses this point.
93 (More precisely, overflow can happen only when the maximum value
94 of the exponent is smaller than the number of mantissa bits.
95 For the IEEE-754 standard 32-bit and 64-bit floating-point numbers
96 the maximum value of the exponent is 128 (respectively, 1024),
97 and the number of mantissa bits is 24 (respectively, 53).)
99 The integral value returned by these functions may be too large
100 to store in an integer type
104 To avoid an overflow, which will produce undefined results,
105 an application should perform a range check on the returned value
106 before assigning it to an integer type.