Floor Function Calculator

Floor Function

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

Rounding Methods Comparison

InputFloor ⌊x⌋Ceil ⌈x⌉Round
2.3232
2.5232
2.7233
-2.3-3-2-2
-2.5-3-2-2

What is the Floor Function?

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.

Key Differences

Floor ⌊x⌋

Always rounds down to the nearest integer (toward -∞)

Ceiling ⌈x⌉

Always rounds up to the nearest integer (toward +∞)

Round(x)

Rounds to the nearest integer (ties to even or away from 0, depending on convention)

Truncate ⌊|x|⌋

Removes the fractional part (rounds toward zero)

Example: Floor of 3.7 and -2.3

⌊3.7⌋:
Greatest integer ≤ 3.7 is 3
⌊-2.3⌋:
Greatest integer ≤ -2.3 is -3 (not -2!)
Note:
Floor rounds toward negative infinity, not toward zero

Frequently Asked Questions

Why does floor round toward -∞?

It's mathematically consistent: ⌊x⌋ ≤ x always holds for all real x. This property is essential in proofs and applications.

What's the fractional part {x}?

Defined as {x} = x - ⌊x⌋, always in [0,1). For x=3.7: {3.7} = 3.7 - 3 = 0.7.

How is floor different from truncation?

For positive x they're the same. For negative: ⌊-2.5⌋ = -3 but trunc(-2.5) = -2.

Where is floor used?

Array indexing, statistics (binning), computer graphics (pixel coordinates), and modulo operations.

What is ⌈x⌉?

The ceiling function: smallest integer ≥ x. Example: ⌈3.2⌉ = 4, ⌈-2.5⌉ = -2.

Is floor related to modulo?

Yes: a mod b = a - b⌊a/b⌋. Floor is used in many modular arithmetic operations.

Can I use floor for negative numbers?

Yes, but remember: ⌊x⌋ rounds away from zero for negative x.

What's the notation {x}?

Fractional part: {x} = x - ⌊x⌋. Also called the mantissa or decimal part.

Related Tools