The math.floor()
function returns the floor value of a real number, which is the largest integer less than or equal to the number. For example, the floor value of 4.7 is 4, because 4 is the largest integer less than or equal to 4.7. Similarly, the floor value of -3.2 is -4, because -4 is the largest integer less than or equal to -3.2.
math.floor(x)
copy
x |
The number whose floor value is to be determined. It can be any valid real number i.e a floating point value or an integer. |
The function returns the floor value of x
. If x
is an integer the return value is just as same as x
.
Compare math.floor()
with math.ceil()
which returns the smallest integer greater then or equal to the input.