Docs.bmc.com will undergo a brief maintenance outage 27 March 2025. The site will be unavailable for ten minutes starting at 6:30 AM CDT/5 PM IST.

ceil()


Return the smallest integer that is not less than the argument.

Syntax

ceil( arg )

 

Parameters

Parameter

Definition

arg

numeric argument whose least integer upper bound is to be determined

Description

The ceil() function returns the smallest integer that is not less than arg, that is, the least integer upper bound for arg

The ceil() function and the floor() function together bracket arg such that the following are true: 

If arg is an integer, ceil( arg ) = arg = floor( arg ) 

If arg is not an integer: floor( arg ) < arg < ceil( arg ) and ceil( arg ) = floor( arg ) + 1

Example

The following example shows how to use the ceil() function:

any_float = 8.4;
ceil_any_float = ceil(any_float);
printf("Ceiling of %f is %d\n",any_float,ceil_any_float);