What the Floor Function computes
The floor function ⌊x⌋ (also written floor(x)) rounds any real number down to the nearest integer — it returns the greatest integer that is less than or equal to x. This calculator finds ⌊x⌋ along with three closely related values: the ceiling ⌈x⌉, the nearest integer, and the fractional part {x}.
How the floor function works
Formally, ⌊x⌋ is the largest integer n such that n ≤ x. For positive numbers this simply drops the decimal part: ⌊7.9⌋ = 7. For negative numbers it rounds away from zero, toward negative infinity, not toward zero: ⌊-3.2⌋ = -4, because -4 is the greatest integer still less than or equal to -3.2 (-3 is greater than -3.2, so it does not qualify). If x is already an integer, ⌊x⌋ = x exactly, e.g. ⌊5⌋ = 5.
Floor vs. ceiling vs. rounding
The ceiling function ⌈x⌉ is the mirror image of floor: it returns the smallest integer greater than or equal to x, and the two are related by ⌈x⌉ = -⌊-x⌋. Standard rounding to the nearest integer can itself be written using floor: round(x) = ⌊x + 0.5⌋. The fractional part {x} = x - ⌊x⌋ is always in the half-open interval [0, 1), even for negative x — for example {-3.2} = -3.2 - (-4) = 0.8.
Where the floor function shows up
- Programming languages implement floor division (Python's
//operator, orMath.floor()in JavaScript) using this exact rule. - Number theory and modular arithmetic define the modulo operation in terms of floor: a mod n = a - n·⌊a/n⌋.
- Everyday rounding-down problems — how many full boxes fit, how many complete weeks have passed — are floor-function problems in disguise.