math.floor

Full name
math.floor
Library
math
Syntax

math.floor(number)

Description

The math.floor function returns the integer closest to argument passed that is less than or equal to it.

Parameters
  • number: number to evaluate
Result

The math.floor function returns an integer.

Examples

The closest integer to the number 5.16 that is less than or equal to it is 5:

math.floor(5.16)

5

On the other hand, the integer closest to the number -5.16 that is less than or equal to it is -6:

math.floor(-5.16)

-6

If the number passed as an argument is an integer, the math.floor function returns the same number:

math.floor(18)

18

Submitted by admin on Tue, 01/19/2021 - 10:40