1CEIL(3) Linux Programmer's Manual CEIL(3)
2
3
4
6 ceil, ceilf, ceill - ceiling function: smallest integral value not less
7 than argument
8
10 #include <math.h>
11
12 double ceil(double x);
13 float ceilf(float x);
14 long double ceill(long double x);
15
16 Link with -lm.
17
19 These functions round x up to the nearest integer.
20
22 The rounded integer value. If x is integral or infinite, x itself is
23 returned.
24
26 No errors other than EDOM and ERANGE can occur. If x is NaN, then NaN
27 is returned and errno may be set to EDOM.
28
30 SUSv2 and POSIX.1-2001 contain text about overflow (which might set
31 errno to ERANGE, or raise an exception). In practice, the result can‐
32 not overflow on any current machine, so this error-handling stuff is
33 just nonsense. (More precisely, overflow can happen only when the max‐
34 imum value of the exponent is smaller than the number of mantissa bits.
35 For the IEEE-754 standard 32-bit and 64-bit floating point numbers the
36 maximum value of the exponent is 128 (resp. 1024), and the number of
37 mantissa bits is 24 (resp. 53).)
38
40 The ceil() function conforms to SVr4, POSIX.1-2001, 4.3BSD, C89, C99.
41 The other functions are from C99.
42
44 floor(3), lrint(3), nearbyint(3), rint(3), round(3), trunc(3)
45
46
47
48 2001-05-31 CEIL(3)