Skip to main content

floor

Function floor 

Source
pub fn floor(x: number) -> number
Expand description

Rounds a number down to the nearest integer.

§Parameters

  • x: a number.

§Return value

The largest integral value less than or equal to x, as an integer. Raises an error if the result does not fit in an integer.

§Examples

print(math.floor(4.7))    --> 4
print(math.floor(-4.7))   --> -5
print(math.floor(7))      --> 7

§See also

ceil, modf, tointeger