ceil, ceilf, ceill, ceild32, ceild64, and ceild128 Subroutines

Purpose

Compute the ceiling value.

Syntax

#include <math.h>

float ceilf (x)
float x;

long double ceill (x)
long double x;

double ceil (x)
double x;

_Decimal32 ceild32(x)
_Decimal32 x;

_Decimal64 ceild64(x)
_Decimal64 x;

_Decimal128 ceild128(x)
_Decimal128 x;

Description

The ceilf, ceill, ceil, ceild32, ceild64, and ceild128 subroutines compute the smallest integral value that is not less than x.

An application wishing to check for error situations should set the errno global variable to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these functions. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.

Parameters

Item Description
x Specifies the smallest integral value to be computed.

Return Values

Upon successful completion, the ceilf, ceill , ceil, ceild32, ceild64, and ceild128 subroutines return the smallest integral value that is not less than x, expressed as a type float, long double, double, _Decimal32, _Decimal64, or _Decimal128 respectively.

If x is NaN, a NaN is returned.

If x is ±0 or ±Inf, x is returned.

If the correct value would cause overflow, a range error occurs and the ceilf, ceill, ceil, ceild32, ceild64, and ceild128 subroutines return the value of the macro HUGE_VALF, HUGE_VALL, HUGE_VAL, HUGE_VAL_D32, HUGE_VAL_D64, and HUGE_VAL_D128 respectively.