1
by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages. |
1 |
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved |
2
by Francesco Paolo Lovergine
* Alligned to linux main manpages edition. |
2 |
.TH "CEIL" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual" |
1
by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages. |
3 |
.\" ceil |
4 |
.SH NAME |
|
5 |
ceil, ceilf, ceill \- ceiling value function
|
|
6 |
.SH SYNOPSIS |
|
7 |
.LP
|
|
8 |
\fB#include <math.h>
|
|
9 |
.br
|
|
10 |
.sp
|
|
11 |
double ceil(double\fP \fIx\fP\fB); |
|
12 |
.br
|
|
13 |
float ceilf(float\fP \fIx\fP\fB); |
|
14 |
.br
|
|
15 |
long double ceill(long double\fP \fIx\fP\fB); |
|
16 |
.br
|
|
17 |
\fP
|
|
18 |
.SH DESCRIPTION |
|
19 |
.LP
|
|
20 |
These functions shall compute the smallest integral value not less |
|
21 |
than \fIx\fP. |
|
22 |
.LP
|
|
23 |
An application wishing to check for error situations should set \fIerrno\fP |
|
24 |
to zero and call |
|
25 |
\fIfeclearexcept\fP(FE_ALL_EXCEPT) before calling these functions. |
|
26 |
On return, if \fIerrno\fP is non-zero or |
|
27 |
\fIfetestexcept\fP(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) |
|
28 |
is non-zero, an error has occurred. |
|
29 |
.SH RETURN VALUE |
|
30 |
.LP
|
|
31 |
Upon successful completion, \fIceil\fP(), \fIceilf\fP(), and \fIceill\fP() |
|
32 |
shall return the smallest integral value not less |
|
33 |
than \fIx\fP, expressed as a type \fBdouble\fP, \fBfloat\fP, or \fBlong |
|
34 |
double\fP, respectively.
|
|
35 |
.LP
|
|
36 |
If |
|
37 |
\fIx\fP is NaN, a NaN shall be returned. |
|
38 |
.LP
|
|
39 |
If \fIx\fP is \(+-0 or \(+-Inf, \fIx\fP shall be returned. |
|
40 |
.LP
|
|
41 |
If the correct value would cause overflow, a range error shall occur |
|
42 |
and \fIceil\fP(), \fIceilf\fP(), and \fIceill\fP() shall |
|
43 |
return the value of the macro HUGE_VAL, HUGE_VALF, and HUGE_VALL, |
|
44 |
respectively. |
|
45 |
.SH ERRORS |
|
46 |
.LP
|
|
47 |
These functions shall fail if: |
|
48 |
.TP 7 |
|
49 |
Range\ Error
|
|
50 |
The result overflows. |
|
51 |
.LP
|
|
52 |
If the integer expression (math_errhandling & MATH_ERRNO) is non-zero, |
|
53 |
then \fIerrno\fP shall be set to [ERANGE]. If the |
|
54 |
integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, |
|
55 |
then the overflow floating-point exception shall be raised. |
|
56 |
.sp
|
|
57 |
.LP
|
|
58 |
\fIThe following sections are informative.\fP |
|
59 |
.SH EXAMPLES |
|
60 |
.LP
|
|
61 |
None. |
|
62 |
.SH APPLICATION USAGE |
|
63 |
.LP
|
|
64 |
The integral value returned by these functions need not be expressible |
|
65 |
as an \fBint\fP or \fBlong\fP. The return value should |
|
66 |
be tested before assigning it to an integer type to avoid the undefined |
|
67 |
results of an integer overflow. |
|
68 |
.LP
|
|
69 |
The \fIceil\fP() function can only overflow when the floating-point |
|
70 |
representation has DBL_MANT_DIG > DBL_MAX_EXP. |
|
71 |
.LP
|
|
72 |
On error, the expressions (math_errhandling & MATH_ERRNO) and (math_errhandling |
|
73 |
& MATH_ERREXCEPT) are independent of |
|
74 |
each other, but at least one of them must be non-zero. |
|
75 |
.SH RATIONALE |
|
76 |
.LP
|
|
77 |
None. |
|
78 |
.SH FUTURE DIRECTIONS |
|
79 |
.LP
|
|
80 |
None. |
|
81 |
.SH SEE ALSO |
|
82 |
.LP
|
|
83 |
\fIfeclearexcept\fP() , \fIfetestexcept\fP() , \fIfloor\fP() , \fIisnan\fP() |
|
84 |
, the Base Definitions volume of |
|
85 |
IEEE\ Std\ 1003.1-2001, Section 4.18, Treatment of Error Conditions |
|
86 |
for |
|
87 |
Mathematical Functions, \fI<math.h>\fP |
|
88 |
.SH COPYRIGHT |
|
89 |
Portions of this text are reprinted and reproduced in electronic form |
|
90 |
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology |
|
91 |
-- Portable Operating System Interface (POSIX), The Open Group Base |
|
92 |
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of |
|
93 |
Electrical and Electronics Engineers, Inc and The Open Group. In the |
|
94 |
event of any discrepancy between this version and the original IEEE and |
|
95 |
The Open Group Standard, the original IEEE and The Open Group Standard |
|
96 |
is the referee document. The original Standard can be obtained online at |
|
97 |
http://www.opengroup.org/unix/online.html . |