Sign in Join
FPDoc Onlineexperiment

Floor function

In unit Math

Return the largest integer smaller than or equal to argument.

Declaration

pascal
function Floor(x: Float): Integer

Description

Floor returns the largest integer smaller than or equal to x. The absolute value of x should be less than maxint.

Errors

If x is larger than maxint, an overflow will occur.

See also

Example: ex13

pascal
Program Example13;

{ Program to demonstrate the floor function. }

Uses math;

begin
  Writeln(Floor(-3.7)); // should be -4
  Writeln(Floor(3.7));  // should be 3
  Writeln(Floor(-4.0)); // should be -4
end.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.