CKTIS / Python
math.ceil
Rounds upward to the smallest integer greater than or equal to the argument.
Version: Python 3.14; repository image, production runtime not attested
Syntax
math.ceil(x, /)Rounds upward to the smallest integer greater than or equal to the argument.
For a negative fraction, rounding upward moves toward zero.
Positive 2.2 needs the next integer, 3, while −2 already bounds −2.2 from above. Truncating 2.2 would produce 2 instead. On a non-float object Python can delegate to its __ceil__ method.
import math
assert math.ceil(2.2) == 3 and math.trunc(2.2) == 2
assert math.ceil(-2.2) == -2
Examples
import math
print(math.ceil(2.2))
print(math.ceil(-2.2))
Result
3 -2
Positive 2.2 needs the next integer, 3, while −2 already bounds −2.2 from above. Truncating 2.2 would produce 2 instead. On a non-float object Python can delegate to its `__ceil__` method.