ceil() function - python math module

The ceil() function in python returns the next bigger integer of a given number

Math Updated 25 Sep 2016 1 min read

Method Name

ceil

Method Signature

ceil(number)

Function Overview

  • The function ceil() returns the next integer bigger than the given number.
  • In other words, the method ceil() returns the smallest integer bigger than the given number.

Example

python
import math

# Find ceiling for pi

ceiling = math.ceil(3.14)

print("Ceiling of pi : {}".format(ceiling))

# Find ceiling for square root of pi

ceiling2 = math.ceil(math.sqrt(3.14))

print("Ceiling of square root of pi : {}".format(ceiling2))

Output

Output
Ceiling of pi : 4

Ceiling of square root of pi : 2