Copyright © 1997 The Open Group

ceil - ceiling value function

`#include <math.h> double ceil(double`

x);

Theceil()function computes the smallest integral value not less thanx.An application wishing to check for error situations should set

errnoto 0 before callingceil(). Iferrnois non-zero on return, or the return value is NaN, an error has occurred.

Upon successful completion,ceil()returns the smallest integral value not less thanx, expressed as a typedouble.If

xis NaN, NaN is returned anderrnomay be set to [EDOM].If the correct value would cause overflow, HUGE_VAL is returned and

errnois set to [ERANGE]. Ifxis ±Inf or ±0, the value ofxis returned.

Theceil()function will fail if:

- [ERANGE]
- The result overflows.
The

ceil()function may fail if:

- [EDOM]
- The value of
xis NaN.No other errors will occur.

None.

The integral value returned byceil()as adoubleneed not be expressible as anintorlong int. The return value should be tested before assigning it to an integer type to avoid the undefined results of an integer overflow.The

ceil()function can only overflow when the floating point representation has DBL_MANT_DIG > DBL_MAX_EXP.

None.

floor(),isnan(),<math.h>.

Derived from Issue 1 of the SVID.

Copyright © 1997 The Open Group

[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]