The floor() method returns the largest integer not greater than x (rounding down).
grammatical
The following is the syntax of the floor() method:
import math ( x )
Note: This function is not directly accessible, so we need to import the math module and then we need to call this function with a static object of math.
parameters
- x -- This is a numeric expression.
return value
This method returns the largest integer that is not greater than x.
(for) instance
The following example shows the use of the floor() method.
#!/usr/bin/python import math # This will import math module print "(-45.17) : ", (-45.17) print "(100.12) : ", (100.12) print "(100.72) : ", (100.72) print "(119L) : ", (119L) print "() : ", ()
When we run the above program, it produces the following results:
(-45.17) : -46.0 (100.12) : 100.0 (100.72) : 100.0 (119L) : 119.0 () : 3.0