1CEIL(3)                    Linux Programmer's Manual                   CEIL(3)
2
3
4

NAME

6       ceil, ceilf, ceill - ceiling function: smallest integral value not less
7       than argument
8

SYNOPSIS

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
18   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
19
20       ceilf(), ceill(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600
21       || _ISOC99_SOURCE; or cc -std=c99
22

DESCRIPTION

24       These  functions  return  the  smallest integral value that is not less
25       than x.
26
27       For example, ceil(0.5) is 1.0, and ceil(-0.5) is 0.0.
28

RETURN VALUE

30       These functions return the ceiling of x.
31
32       If x is integral, +0, -0, NaN, or infinite, x itself is returned.
33

ERRORS

35       No errors occur.  POSIX.1-2001 documents a range error  for  overflows,
36       but see NOTES.
37

CONFORMING TO

39       C99, POSIX.1-2001.  The variant returning double also conforms to SVr4,
40       4.3BSD, C89.
41

NOTES

43       SUSv2 and POSIX.1-2001 contain text about  overflow  (which  might  set
44       errno  to ERANGE, or raise an FE_OVERFLOW exception).  In practice, the
45       result cannot overflow on any current machine, so  this  error-handling
46       stuff is just nonsense.  (More precisely, overflow can happen only when
47       the maximum value of the exponent is smaller than the  number  of  man‐
48       tissa bits.  For the IEEE-754 standard 32-bit and 64-bit floating-point
49       numbers the maximum value of the exponent is 128 (respectively,  1024),
50       and the number of mantissa bits is 24 (respectively, 53).)
51
52       The  integral  value  returned  by  these functions may be too large to
53       store in an integer type (int, long,  etc.).   To  avoid  an  overflow,
54       which  will  produce undefined results, an application should perform a
55       range check on the returned value before assigning  it  to  an  integer
56       type.
57

SEE ALSO

59       floor(3), lrint(3), nearbyint(3), rint(3), round(3), trunc(3)
60

COLOPHON

62       This  page  is  part of release 3.25 of the Linux man-pages project.  A
63       description of the project, and information about reporting  bugs,  can
64       be found at http://www.kernel.org/doc/man-pages/.
65
66
67
68                                  2008-08-05                           CEIL(3)
Impressum