Floor Function Calculator

Enter a real number x. Floor ⌊x⌋ is the greatest integer n ≤ x. ⌊3.7⌋ = 3. ⌊−1.2⌋ = −2 (not −1). ⌊5⌋ = 5.

Input

Result

Enter x, for example 3.7 or −1.2.

The calculator returns the integer part toward −∞. For negative non-integers the result differs from truncation toward zero. A whole x stays itself.

How it works

How ⌊3.7⌋ is computed
x3.7
n ≤ x < n+13 ≤ 3.7 < 4
⌊x⌋3

The floor function, written ⌊x⌋ (Iverson’s notation popularized by Donald Knuth), is the greatest integer that does not exceed x. Formally: ⌊x⌋ = n ∈ ℤ if and only if n ≤ x < n+1. For x = 3.7 we have 3 ≤ 3.7 < 4, so ⌊3.7⌋ = 3. When x is already an integer the interval is [x, x+1), so ⌊5⌋ = 5.

For negatives, floor does not clip toward zero. ⌊−1.2⌋ = −2, because −2 ≤ −1.2 < −1; −1 is already larger than −1.2. Truncation (trunc) would give −1, and ceil ⌈−1.2⌉ = −1. That gap is the most common classroom and coding trap.

The floor-based fractional part is {x} = x − ⌊x⌋ and always lies in [0, 1). For 3.7 it is 0.7; for −1.2 it is 0.8 (not −0.2). The fractional-part calculator on the neighbouring page uses the same formula; here the result is the integer n alone.

The calculator uses the number x you enter in the “Number x” field. The calculator computes ⌊x⌋ — matching the mathematical floor for finite numbers. A comma and a period are equivalent.

The mathematical model is the classical floor (integer-part) function from real analysis and from Concrete Mathematics (Graham, Knuth, Patashnik). NIST DLMF §1.4 lists floor among elementary functions. Do not confuse it with rounding to n decimal places, which keeps a fraction.

Reference examples: ⌊3.7⌋ = 3, ⌊−1.2⌋ = −2, ⌊5⌋ = 5, ⌊0.9⌋ = 0, ⌊−0.1⌋ = −1, ⌊−3⌋ = −3. The result panel also shows ceil, trunc, {x}, and the interval [n, n+1), and the diagram places x on the number line against the floor step.

Formula

⌊x⌋ = n, where n ∈ ℤ and n ≤ x < n+1.

Equivalently: ⌊x⌋ = max{ k ∈ ℤ : k ≤ x }. Symbol x is the entered number (the “Number x” field). Symbol n is the integer result. Fractional part: {x} = x − ⌊x⌋ ∈ [0, 1).

Computation: ⌊x⌋. Mathematical model: floor (integer-part) function — NIST DLMF §1.4; Concrete Mathematics (Graham, Knuth, Patashnik).

Theory, trunc/ceil, and negatives

Definition

The integer part in the floor sense, written ⌊x⌋, is the greatest integer not exceeding x. Formally: ⌊x⌋ = max{ n ∈ ℤ : n ≤ x }. For x ≥ 0 this matches the school habit of cutting off the fractional digits downward; for x < 0, floor moves toward −∞, not toward zero. Example: ⌊3.7⌋ = 3, but ⌊−1.2⌋ = −2, not −1.

The definition of floor (and the dual ceiling ⌈x⌉) is standard in NIST DLMF §1.4 (Floor and Ceiling), Graham–Knuth–Patashnik Concrete Mathematics, and MathWorld (Floor Function). The calculator computes floor — the same function the browser provides.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Historical and conceptual context

The notation ⌊x⌋ was popularized by Kenneth E. Iverson (APL) and then by Concrete Mathematics (Knuth et al.). Older texts spoke of “entier” (Gauss) — the greatest integer ≤ x, i.e. floor. In computing, distinguishing floor, trunc (toward zero), and ceil is critical for array indexing and for negative integer division.

Conceptually floor is not rounding to the nearest integer. It is also not the fractional part. The analytic fractional part is {x} = x − ⌊x⌋ ∈ [0, 1); a separate calculator on this site computes {x}.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Formal properties

Domain: ℝ (in practice finite floating-point numbers). Codomain: ℤ. The function is nondecreasing, right-continuous, with jumps at the integers. ⌊x⌋ = x ⇔ x ∈ ℤ.

Identities: ⌊x⌋ ≤ x < ⌊x⌋ + 1; ⌊x + n⌋ = ⌊x⌋ + n for n ∈ ℤ; ⌊−x⌋ = −⌈x⌉. For positive a, b, formulas for ⌊a/b⌋ in integer arithmetic depend on signs — hence programming languages disagree on negative division.

Link to the fractional part: x = ⌊x⌋ + {x}, 0 ≤ {x} < 1. Ceiling: ⌈x⌉ = −⌊−x⌋.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Full derivation

Step 1. The set { n ∈ ℤ : n ≤ x } is nonempty and bounded above by x, so a maximum exists in ℤ — denote it ⌊x⌋.

Step 2. By maximality: ⌊x⌋ ≤ x and ⌊x⌋ + 1 > x, hence ⌊x⌋ ≤ x < ⌊x⌋ + 1.

Step 3 (integer shift). If n ∈ ℤ, then m ≤ x ⇔ m + n ≤ x + n, so the max shifts by n: ⌊x + n⌋ = ⌊x⌋ + n.

Step 4 (negatives). For x = −1.2 the integers ≤ −1.2 are …, −3, −2; the maximum is −2. Truncation toward zero would give −1 — a different function. Concrete Mathematics and Knuth stress this distinction.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Special cases

Examples: ⌊3.7⌋ = 3; ⌊5⌋ = 5; ⌊0.9⌋ = 0; ⌊−0.1⌋ = −1; ⌊−1.2⌋ = −2; ⌊−3⌋ = −3. On the integers, floor is the identity.

Limits: as x → n⁻ for an integer n, ⌊x⌋ = n − 1; as x → n⁺, ⌊x⌋ = n. The step graph jumps at every integer (right-continuous).

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Numerical and computational notes

floor operates on floating-point numbers. For |x| > 2⁵³ not every integer is exactly representable — floor then acts on an already rounded machine value. Comma and period are equivalent.

The panel may show ceil, trunc, and {x}. The calculator does not compute modulo or integer division with remainder — only ⌊x⌋.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

Related concepts and authorities

Related: fractional part {x} = x − ⌊x⌋, decimal-to-fraction, maximum of two numbers. Round-to-nearest is a separate model.

Authorities: NIST DLMF §1.4; Graham, Knuth, Patashnik — Concrete Mathematics; MathWorld — Floor Function; Knuth, TAOCP. Educational tool.

In classroom practice it helps to separate the mathematical formula from floating-point limits: this calculator reports the browser’s floating-point computation (about 15–16 significant digits), not a symbolic identity on paper. When inputs are extreme, check the domain first, then the floating-point range.

How to use

  1. Enter x in Number x, for example 3.7 or −1.2.
  2. Click Calculate or wait for the live result. 3.7 gives 3. −1.2 gives −2.
  3. Check the panel: ceil, trunc, fractional part {x}, and interval [n, n+1). The number-line diagram marks x and ⌊x⌋.
  4. Whole 5 stays 5. 0.9 gives 0. −0.1 gives −1.
  5. Ceiling of the same x lives on the neighbouring ceil page; the fractional part alone lives on the fractional-part page.

Symbol glossary

Floor returns the greatest integer ≤ x. ⌊3.7⌋ = 3. ⌊−1.2⌋ = −2. Trunc at −1.2 would give −1.

⌊x⌋
Floor / integer part: greatest n ∈ ℤ with n ≤ x. Primary result field.
x
Number in the “Number x” field. 3.7, −1.2, 5, 0.9…
{x}
x − ⌊x⌋, always in [0, 1). For −1.2 it is 0.8.
trunc
Truncation toward zero (trunc). Matches floor for positives; differs for negative non-integers.

Examples

Example 1

  • x = 3.7

3

What is ⌊3.7⌋? 3.

Example 2

  • x = −1.2

−2

What is ⌊−1.2⌋? −2 (not −1).

Example 3

  • x = 5

5

What is ⌊5⌋? 5.

Example 4

  • x = 0.9

0

What is ⌊0.9⌋? 0.

Example 5

  • x = −0.1

−1

What is ⌊−0.1⌋? −1 (trunc = 0).

Example 6

  • x = −3

−3

What is ⌊−3⌋? −3.

Related calculators

Common questions

What does ⌊x⌋ (floor, integer part) mean?

⌊x⌋ is the greatest integer n such that n ≤ x. Equivalently: n ≤ x < n+1. The calculator returns that integer; the fractional part {x} = x − ⌊x⌋ lies in [0, 1).

What is ⌊3.7⌋?

The result is 3. Three satisfies 3 ≤ 3.7 < 4, and four does not. That is the first worked example on this page.

What is ⌊−1.2⌋, and why not −1?

The result is −2, not −1. Floor steps toward −∞: −2 ≤ −1.2 < −1, while −1 is already larger than −1.2. Truncation toward zero would give −1.

How does floor differ from ceil, trunc, and int?

Ceil ⌈x⌉ is the least integer ≥ x. Trunc drops the fraction toward zero. “Int” in some languages aliases trunc or floor — here it is always floor. For −1.2: floor = −2, trunc = −1, ceil = −1.

What is the fractional part {x}?

{x} = x − ⌊x⌋. For x = 3.7 it is 0.7; for x = −1.2 it is 0.8. Always 0 ≤ {x} < 1. The fractional-part page uses the same formula.

What are ⌊5⌋, ⌊0.9⌋, and ⌊−0.1⌋?

⌊5⌋ = 5 (a whole x stays itself). ⌊0.9⌋ = 0. ⌊−0.1⌋ = −1, because −1 ≤ −0.1 < 0.

How does floor behave in computer arithmetic?

The browser calls ⌊x⌋ on a floating-point number. For finite x the result matches mathematical floor; very large |x| may already lose fractional bits in the floating-point representation itself.

Does a comma in 3.7 work?

Yes. 3.7 and 3,7 both give 3. The field accepts US and European decimal writing.

Do the currency and unit settings in the page header affect the result?

No. The result depends only on the entered x. The currency and unit settings in the page header do not affect this result.

Where do the definition and the ⌊x⌋ notation come from?

Iverson/Knuth bracket notation is standard in analysis and in Concrete Mathematics (Graham, Knuth, Patashnik). NIST DLMF §1.4 lists floor among elementary functions. The computation here is floor.

How do I calculate the floor (integer part)?

Take the greatest integer n such that n ≤ x. For 3.7 that is 3; for −1.2 that is −2. Floor always moves toward −∞, not toward zero.

What is the floor function ⌊x⌋?

Floor, greatest integer, or entier is ⌊x⌋ = max{n ∈ ℤ : n ≤ x}. The ⌊x⌋ notation is standard; code often uses floor(x). Do not confuse it with truncation toward zero.

How does floor differ from rounding down?

For positive numbers the results match. For negatives, floor goes to −∞ (⌊−2.1⌋ = −3), while “down toward zero” would give −2. This calculator always computes floor.

What is ⌊π⌋?

3, because 3 ≤ π ≈ 3.14159 < 4. Enter about 3.14159 to see the same result.

Are floor and trunc the same?

Only for x ≥ 0. When x < 0 they differ: ⌊−1.2⌋ = −2, while trunc(−1.2) = −1. The panel shows trunc beside floor so you can see the difference.

The result is ⌊x⌋: for x = 3.7 it is 3; for x = −1.2 it is −2 (trunc would give −1). Separate ceil and fractional-part tools are on neighbouring pages.

Knowledge sources

The definition, ⌊x⌋ notation, and ceil comparison come from established sources.

Page Updated November 2, 2026.