Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

FLOOR

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

result = FLOOR (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 greatest integer less than or equal to a.

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

Example

FLOOR (4.8) has the value 4.

FLOOR (-5.6) has the value -6.

The following shows another example:

I = FLOOR(3.1)  ! returns 3
I = FLOOR(-3.1) ! returns -4

See Also