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():
21           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
22               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
23               || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
24

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

ATTRIBUTES

41       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
42       tributes(7).
43
44       ┌────────────────────────────────────────────┬───────────────┬─────────┐
45Interface                                   Attribute     Value   
46       ├────────────────────────────────────────────┼───────────────┼─────────┤
47ceil(), ceilf(), ceill()                    │ Thread safety │ MT-Safe │
48       └────────────────────────────────────────────┴───────────────┴─────────┘
49

CONFORMING TO

51       C99, POSIX.1-2001, POSIX.1-2008.
52
53       The variant returning double also conforms to SVr4, 4.3BSD, C89.
54

NOTES

56       SUSv2 and POSIX.1-2001 contain text about overflow (which might set er‐
57       rno to ERANGE, or raise an FE_OVERFLOW exception).   In  practice,  the
58       result  cannot  overflow on any current machine, so this error-handling
59       stuff is just nonsense.  (More precisely, overflow can happen only when
60       the maximum value of the exponent is smaller than the number of mantis‐
61       sa bits.  For the IEEE-754 standard 32-bit  and  64-bit  floating-point
62       numbers  the maximum value of the exponent is 128 (respectively, 1024),
63       and the number of mantissa bits is 24 (respectively, 53).)
64
65       The integral value returned by these functions  may  be  too  large  to
66       store  in  an  integer  type  (int, long, etc.).  To avoid an overflow,
67       which will produce undefined results, an application should  perform  a
68       range  check  on  the  returned value before assigning it to an integer
69       type.
70

SEE ALSO

72       floor(3), lrint(3), nearbyint(3), rint(3), round(3), trunc(3)
73

COLOPHON

75       This page is part of release 5.13 of the Linux  man-pages  project.   A
76       description  of  the project, information about reporting bugs, and the
77       latest    version    of    this    page,    can     be     found     at
78       https://www.kernel.org/doc/man-pages/.
79
80
81
82                                  2021-03-22                           CEIL(3)
Impressum