Calculate ⌊x⌋, the greatest integer less than or equal to x. Includes comparison with ceiling, rounding, and truncation.
Last updated: May 2026 | By Patchworkr Team
| Input | Floor ⌊x⌋ | Ceil ⌈x⌉ | Round |
|---|---|---|---|
| 2.3 | 2 | 3 | 2 |
| 2.5 | 2 | 3 | 2 |
| 2.7 | 2 | 3 | 3 |
| -2.3 | -3 | -2 | -2 |
| -2.5 | -3 | -2 | -2 |
The floor function, denoted $\lfloor x \rfloor$, takes a real number $x$ and returns the greatest integer that is less than or equal to $x$. For positive numbers, it simply truncates the decimal part. For negative numbers, it rounds away from zero toward negative infinity.
The floor function is fundamental in computer science (array indexing), statistics (binning), and mathematics (step functions, number theory). It's distinguished from rounding and ceiling functions by its consistent "round down" behavior.
Always rounds down to the nearest integer (toward -∞)
Always rounds up to the nearest integer (toward +∞)
Rounds to the nearest integer (ties to even or away from 0, depending on convention)
Removes the fractional part (rounds toward zero)
It's mathematically consistent: ⌊x⌋ ≤ x always holds for all real x. This property is essential in proofs and applications.
Defined as {x} = x - ⌊x⌋, always in [0,1). For x=3.7: {3.7} = 3.7 - 3 = 0.7.
For positive x they're the same. For negative: ⌊-2.5⌋ = -3 but trunc(-2.5) = -2.
Array indexing, statistics (binning), computer graphics (pixel coordinates), and modulo operations.
The ceiling function: smallest integer ≥ x. Example: ⌈3.2⌉ = 4, ⌈-2.5⌉ = -2.
Yes: a mod b = a - b⌊a/b⌋. Floor is used in many modular arithmetic operations.
Yes, but remember: ⌊x⌋ rounds away from zero for negative x.
Fractional part: {x} = x - ⌊x⌋. Also called the mantissa or decimal part.
Related Tools