Function Ceil(x)

Ceil

Ceil(
    x             ! (input) numerical expression
    )

Arguments

x

A scalar numerical expression.

Return Value

The function Ceil returns the smallest integer value \(\geq\) x.

Example

_p_returnA := ceil(-1.00); ! returns -1
_p_returnB := ceil(-0.99); ! returns  0
_p_returnC := ceil( 0   ); ! returns  0
_p_returnD := ceil( 0.99); ! returns  1

Note

  • The function Ceil will round to the nearest integer, if it lies within the equality tolerances equality_absolute_tolerance and equality_relative_tolerance.

  • The function Ceil can be used in the constraints of nonlinear mathematical programs. However, nonlinear solvers may experience convergence problems around integer values.

  • When the numerical expression contains a unit, the function Ceil will first convert the expression to the corresponding base unit, before evaluating the function itself.

See also

The functions Floor, Round, Precision, Trunc. Arithmetic functions are discussed in full detail in Arithmetic Functions of the Language Reference. Numeric tolerances are discussed in Arithmetic Functions of the Language Reference.