50 of 151 menu

The ceil method of math module

The method ceil modulo math rounds a number to integers always up.

Syntax

import math math.ceil(number)

Example

Let's round up the number 25.38:

import math print(math.ceil(25.38))

Result of code execution:

26

Example

Now let's apply the ceil method to the number -4.88:

import math print(math.ceil(-5.25))

Result of code execution:

-5

See also

  • function round,
    which rounds off the number
  • method floor of module math,
    which rounds a number down
byenru