math.floor()
math.floor() is a Python function in the Math Module category. Returns the largest integer less than or equal to x. The syntax is math.floor(x). Returns: Integer. A typical example: math.floor(3.14) # 3
math.floor(-3.14) # -4. A close sibling is math.ceil(), which returns the smallest integer greater than or equal to x. A close sibling is math.trunc(), which truncates the fractional part, returning the integer part. A close sibling is math.fabs(), which returns the absolute value of x as a float. A close sibling is math.sqrt(), which returns the square root of x. More about this category: Mathematical functions — sin, cos, sqrt, floor, ceil, and constants. For a broader walkthrough, read the Math Module guide. Related Math Module entries: math.ceil(), math.trunc(), math.fabs(), math.sqrt(), math.pow(), math.exp(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.