Ceil

From Pico-8 Wiki
Jump to navigation Jump to search
ceil( num )
Returns the nearest integer at or above a number (its "ceiling").
num
The number.

return-value
The nearest integer at or above num.

If the given number is a fractional value between two integers, the higher integer is returned.

If the given number is already exactly an integer, it is returned as-is.

Examples

print(ceil(5.9))   -- 6

print(ceil(-5.2))  -- -5

print(ceil(7))     -- 7

print(ceil(-7))    -- -7

See also