LF Fortran 95

FLOOR Function


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


FLOOR (a [, kind])

Required Arguments

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

Optional Arguments

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.


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

See Also

KIND Function