The FLOOR function returns the greatest INTEGER number less than or equal to a REAL argument.

## Syntax

FLOOR (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 largest integer less 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(*,*) floor(r) ! writes 4 write(*,*) floor(-r,selected_int_kind(2)) ! writes -5 write(*,*) floor(x) ! writes -1 0 0