The CEILING function returns the smallest INTEGER number greater than or equal to a REAL number.

## Syntax

CEILING (a [,kind])

a is an INTENT(IN) scalar or array of type REAL.

kind is INTENT(IN) and determines the kind of the result. It must be a scalar INTEGER expression that can be evaluated at compile time. To maintain portability, this argument should be the result of a KIND Function or SELECTED_INT_KIND Function.

The result is an INTEGER number whose value is the smallest integer greater than or equal to a.

If kind is present, it specifies the kind of the result.

If kind is absent, the result is type default INTEGER.

## Example

real :: r=4.7, x(3)=(/-.5,0.,.5/) write(*,*) ceiling(r) ! writes 5 write(*,*) ceiling(-r,selected_int_kind(2)) ! writes -4 write(*,*) ceiling(x) ! writes 0 0 1