CEIL Ceiling Function

Section: Elementary Functions


Computes the ceiling of an n-dimensional array elementwise. The ceiling of a number is defined as the smallest integer that is larger than or equal to that number. The general syntax for its use is
   y = ceil(x)

where x is a multidimensional array of numerical type. The ceil function preserves the type of the argument. So integer arguments are not modified, and float arrays return float arrays as outputs, and similarly for double arrays. The ceil function is not defined for complex or dcomplex types.


The following demonstrates the ceil function applied to various (numerical) arguments. For integer arguments, the ceil function has no effect:
--> ceil(3)

ans = 

--> ceil(-3)

ans = 

Next, we take the ceil of a floating point value:

--> ceil(float(3.023))

ans = 

--> ceil(float(-2.341))

ans = 

Note that the return type is a float also. Finally, for a double type:

--> ceil(4.312)

ans = 

--> ceil(-5.32)

ans =