What Is the Floor Function?

The floor function takes any real number and returns the greatest integer that does not exceed it. Mathematically, for a number x, the floor returns the largest integer n from the set of all integers where nx.

Common notation uses square brackets: ⌊x⌋. For example:

  • ⌊3⌋ = 3 (it's already an integer)
  • ⌊3.7⌋ = 3 (the greatest integer ≤ 3.7)
  • ⌊−2.3⌋ = −3 (the greatest integer ≤ −2.3, not −2)
  • ⌊π⌋ = 3 (since π ≈ 3.14159...)

The function maps all real numbers onto the set of integers, forming a step-like pattern when graphed. Each horizontal segment spans an interval of length 1 on the real number line.

Floor Function Formula

The floor function is defined as the maximum integer not exceeding the input:

⌊x⌋ = max{n ∈ ℤ : n ≤ x}

  • x — Any real number (integer, decimal, or negative)
  • ⌊x⌋ — The floor of x; always an integer

Key Properties of the Floor Function

Understanding these mathematical properties helps predict floor function behavior without calculation:

  • Bounding property: Any real number sits strictly between its floor and floor plus one: ⌊x⌋ ≤ x < ⌊x⌋ + 1
  • Integer gaps: The distance from a number to its floor never exceeds 1: x − 1 < ⌊x⌋ ≤ x
  • Integer addition: Adding an integer n to the input gives ⌊x + n⌋ = ⌊x⌋ + n
  • Idempotence: Applying the floor twice yields the same result as applying it once: ⌊⌊x⌋⌋ = ⌊x
  • Not one-to-one: Multiple inputs map to the same output (e.g., both 2.1 and 2.9 have floor 2)

Graph and Continuity

The floor function produces a distinctive step graph with horizontal segments and vertical jumps at every integer. Filled dots mark included endpoints (at integers), and empty dots mark excluded endpoints.

The function is discontinuous at all integer values. At each integer n, the function jumps from n − 1 to n. For non-integer values, the function is continuous—it remains flat across each interval [n, n+1).

Despite its step-like appearance, the floor function remains well-defined everywhere and is fully invertible if you track which interval the input falls within.

Common Pitfalls and Practical Tips

Avoid these frequent mistakes when working with floor functions:

  1. Negative numbers behave differently — ⌊−2.3⌋ equals −3, not −2. The floor always rounds toward negative infinity, not toward zero. Many programming languages have separate functions: floor (toward −∞) and trunc (toward 0).
  2. Discontinuity means no derivative at integers — The floor function has no derivative at integer points because it jumps instantaneously. Between integers, you could argue it has a derivative of zero, but this is rarely useful.
  3. Rounding down is not the same as floor — For positive numbers, floor equals rounding down. For negative numbers, they differ. Floor of −1.5 is −2; rounding down −1.5 might give −1 depending on convention.
  4. Check your programming language's syntax — Python uses math.floor(), Excel uses FLOOR.MATH(), SQL varies by database. Always verify your tool's exact behavior with test cases before relying on it in production code.

Frequently Asked Questions

How do I calculate the floor of a negative decimal like −4.7?

Identify all integers less than or equal to −4.7: these are −5, −6, −7, and so on. The greatest of these is −5. Therefore, ⌊−4.7⌋ = −5. The key is remembering that floor always rounds toward negative infinity, never toward zero. This often surprises people accustomed to truncation-style rounding.

Is the floor function continuous everywhere?

No. The floor function is continuous across every open interval between integers—for example, it's flat and continuous on (2, 3)—but it jumps discontinuously at every integer. At each integer <em>n</em>, the function jumps from a value of <em>n</em>−1 to <em>n</em>. This makes the left-hand and right-hand limits different at integer points.

Why isn't the floor function one-to-one?

Because every interval [<em>n</em>, <em>n</em>+1) maps to the single integer <em>n</em>. For example, both 5.2 and 5.8 have floor 5. Infinitely many real numbers compress into a single integer output. In formal terms, the function is not injective, so it has no true inverse function without restricting the domain first.

How do I type the floor function in LaTeX?

Use \lfloor for the left bracket and \rfloor for the right bracket. For example, typing \lfloor x \rfloor produces ⌊x⌋. To show the floor of a more complex expression like (x + y), write \lfloor x + y \rfloor. Most mathematical typesetting systems follow this standard notation.

What's the difference between floor and truncation?

Floor always rounds toward negative infinity, while truncation rounds toward zero. For positive numbers, they're identical: floor(3.9) = trunc(3.9) = 3. For negative numbers, they differ: floor(−3.9) = −4, but trunc(−3.9) = −3. Programming languages often offer both; choose based on whether you need mathematical floor behavior or simple decimal-removal.

How does the floor function appear in real applications?

The floor function appears in scheduling (determining how many full time periods fit into a span), memory allocation (calculating how many complete chunks fit in a buffer), probability (histogram binning), and database pagination (computing how many full pages of results exist). Wherever you convert continuous measurements into discrete counts by rounding downward, you're using floor logic.

More math calculators (see all)