Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public
Document Table of Contents

CEILING

Elemental Intrinsic Function (Generic): Returns the smallest integer greater than or equal to its argument.

result = CEILING (a[,kind])

a

(Input) Must be of type real.

kind

(Input; optional) Must be a scalar integer constant expression.

Results

The result type is integer. If kind is present, the kind parameter of the result is that specified by kind; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined.

The value of the result is equal to the smallest integer greater than or equal to a.

The setting of compiler options specifying integer size can affect this function.

Example

CEILING (4.8) has the value 5.

CEILING (-2.55) has the value -2.0.

The following shows another example:

INTEGER I, IARRAY(2)
I = CEILING(8.01) ! returns 9
I = CEILING(-8.01) ! returns -8
IARRAY = CEILING((/8.01,-5.6/)) ! returns (9, -5)

See Also