FLOOR

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

Syntax

result = FLOOR (a [, kind])

a
(Input) Must be of type real.

kind
(Optional; input) Must be a scalar integer initialization expression. This argument is a Fortran 95 feature.

Results:

The result is of type 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.

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB

See Also: CEILING

Examples

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