2 .\" Copyright 2001 Andries Brouwer <aeb@cwi.nl>.
3 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4 .\" <mtk.manpages@gmail.com>
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
8 .TH ceil 3 (date) "Linux man-pages (unreleased)"
10 ceil, ceilf, ceill \- ceiling function: smallest integral value not
14 .RI ( libm ", " \-lm )
19 .BI "double ceil(double " x );
20 .BI "float ceilf(float " x );
21 .BI "long double ceill(long double " x );
25 Feature Test Macro Requirements for glibc (see
26 .BR feature_test_macros (7)):
32 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
33 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
34 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
37 These functions return the smallest integral value that is not less than
46 These functions return the ceiling of
51 is integral, +0, \-0, NaN, or infinite,
56 POSIX.1-2001 documents a range error for overflows, but see NOTES.
58 For an explanation of the terms used in this section, see
64 Interface Attribute Value
71 T} Thread safety MT-Safe
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 127 (respectively, 1023),
97 and the number of mantissa bits
98 including the implicit bit
99 is 24 (respectively, 53).)
101 The integral value returned by these functions may be too large
102 to store in an integer type
106 To avoid an overflow, which will produce undefined results,
107 an application should perform a range check on the returned value
108 before assigning it to an integer type.