The floor method of the math module

The floor modulo math method rounds a number to integers always down.

Syntax

pythonimport math

math.floor(number)

Example

Let's round down the number 25.78:

pythonimport math

print(math.floor(25.78))

Result of code execution:

python25

Example

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

pythonimport math

print(math.floor(-4.88))

Result of code execution:

python-5

See also

  • function round,
    which rounds off the number
  • method ceil of module math,
    which rounds a number up