Math module

floor

procedure · 2 overloadsSource

The largest whole number not above x, as a float or float64. It rounds toward negative infinity, so floor(-1.2) is -2. Infinities, NaN and values already whole are returned as they are.

ExampleOpen in playground ↗
assert(floor(1.8) == 1 && floor(-1.2) == -2 && floor(3.0) == 3);
floor :: (x: float64) -> float64

Rounds down to a whole number.

Parameters

x: float64
the value to round.

Returns

float64
floor :: (f: float) -> float

Rounds down to a whole number.

Parameters

f: float
the value to round.

Returns

float

See also