On this page
math.ceil
Prev: math.cbrt | Up: math | Next: math.comb
Rel: math.acos, math.acosh, math.asin, math.asinh
Ref: docs.python.org — math.ceil
Tags: #public #python3 #stdlib #math
Import
import math
from math import ceil
Signature & Overview
math.ceil(x, /)
Return the ceiling of x as an Integral.
Usage
import math
assert math.ceil(2.1) == 3
assert math.ceil(-2.1) == -2
Gotchas
- Returns an
int(notfloat) in Python 3: For negative numbers, rounds toward $+\infty$ (ceil(-2.1) == -2, not-3).
REPL Inspect
from math import ceil
help(ceil)
Linked from
Related notes
- tuts/python3/stdlib_module/math/cbrt Linked here; links to this page; shared tags: #math, #stdlib
- tuts/python3/stdlib_module/math/comb Linked here; links to this page; shared tags: #math, #stdlib
- tuts/python3/stdlib_module/math Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/math/acos Linked here; shared tags: #math, #stdlib
- tuts/python3/stdlib_module/math/acosh Linked here; shared tags: #math, #stdlib
- tuts/python3/stdlib_module/math/asin Linked here; shared tags: #math, #stdlib
- tuts/python3/stdlib_module/math/asinh Linked here; shared tags: #math, #stdlib
- tuts/c/stdlib/math shared tags: #math, #stdlib
- tuts/c/stdlib/math/fabs shared tags: #math, #stdlib
- tuts/c/stdlib/math/floor shared tags: #math, #stdlib