floor()
floor() method in Python returns floor of x i.e., the largest integer not greater than x.
Syntax: import math math.floor(x) Parameter: x-numeric expression. Returns: largest integer not greater than x.
Below is the Python implementation of floor() method:
# Python program to demonstrate the use of floor() method # This will import math module import math # prints the ceil using floor() method print "math.floor(-23.11) : ", math.floor(-23.11) print "math.floor(300.16) : ", math.floor(300.16) print "math.floor(300.72) : ", math.floor(300.72) |
Output:
math.floor(-23.11) : -24.0 math.floor(300.16) : 300.0 math.floor(300.72) : 300.0
ceil()
The method ceil() in Python returns ceiling value of x i.e., the smallest integer not less than x.
Syntax: import math math.ceil(x) Parameter: x:This is a numeric expression. Returns: Smallest integer not less than x.
Below is the Python implementation of ceil() method:
# Python program to demonstrate the use of ceil() method # This will import math module import math # prints the ceil using ceil() method print "math.ceil(-23.11) : ", math.ceil(-23.11) print "math.ceil(300.16) : ", math.ceil(300.16) print "math.ceil(300.72) : ", math.ceil(300.72) |
Output:
math.ceil(-23.11) : -23.0 math.ceil(300.16) : 301.0 math.ceil(300.72) : 301.0
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
Recommended Posts:
- Ceil and floor of the dataframe in Pandas Python – Round up and Truncate
- Python | math.ceil() function
- numpy.ceil() in Python
- Python | Pandas DatetimeIndex.ceil()
- Python | Pandas TimedeltaIndex.ceil
- Python | Pandas Timestamp.ceil
- Python | Pandas Timedelta.ceil()
- Python | Pandas Series.dt.ceil
- Python - PyTorch ceil() method
- Python - tensorflow.math.ceil()
- Python | math.floor() function
- Check the equality of integer division and math.floor() of Regular division in Python
- Python | Pandas Series.dt.floor
- numpy.floor() in Python
- Python | Pandas DatetimeIndex.floor()
- Python | Pandas TimedeltaIndex.floor
- Python | Pandas Timestamp.floor
- Python | Pandas Timedelta.floor()
- Python - PyTorch floor() method
- Python - tensorflow.math.floor()
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
