Contents Previous Next Subchapters

Smallest Integer Greater Than or Equal a Specified Value
Syntax ceil(x)
See Also floor , roundoff , int , mod

Description
Returns the element-by-element largest integer that is less than or equal the corresponding element of x where x is an integer, real, or double-precision matrix.

Example
     y = [ -1.4, -.6, 1.4, 2.] 
     ceil(y)
returns
     [-1 , 0 , 2 , 2]

Reference
Note that the elements of the return value are integers but the return value has the same type as x.

Mlmode
In Mlmode , x can also be a logical, character or complex matrix. In the complex case, the floor function applies to the real and imaginary parts separately.