floor function - python math module

floor function in python returns the next smallest integer of the given number

Math Updated 25 Sep 2016 1 min read

Method Name

floor(aNumber_in)

Method Overview

Returns the next integer smaller than the given number.
In other words, the method floor returns the biggest integer smaller than the given number.

Example

python
import math

# Find floor for Golden Ration

GoldenRatio = 1.61803398874

floor1      = math.floor(GoldenRatio)

print("Floor of Golden Ratio : {}".format(floor1))

# Find floor for Euler Number

EulerNumber =    2.71828

floor2      = math.floor(EulerNumber)

print("Floor of Euler Number : {}".format(floor2))

Output

Output
Floor of Golden Ratio : 1

Floor for Euler Number : 2