Full name
math.ceil
Library
math
Syntax
math.ceil(number)
Description
The math.ceil function returns the integer closest to the argument passed that is greater than or equal to it.
Parameters
- number: number to evaluate
Result
The math.ceil function returns an integer.
Examples
The closest integer to the number 5.16 that is greater than or equal to it is 6:
math.ceil(5.16)
6
On the other hand, the integer closest to the number -5.16 that is greater than or equal to it is -5:
math.ceil(-5.16)
-5
If the number passed as an argument is an integer, the math.ceil function returns the same number:
math.ceil(18)
18