🧮
🧮 Math & statistics

Floor and Ceiling Function Calculator (⌊x⌋, ⌈x⌉, truncation, fractional part)

Results update as you type.

Your numbers

Understanding the floor and ceiling function calculator — concept and principle

This calculator gives the floor ⌊x⌋, the ceiling ⌈x⌉, the truncation and the fractional part of a real number, optionally after dividing by d, together with the floored remainder. Use it for discrete math, programming (integer division and rounding) and everyday rounding questions such as how many boxes are needed.

Floor and ceilingWhere −3.7 rounds to−6−5−4−3−2−1−3.7floor −4ceiling −3Truncate−3Fraction part0.3
Floor always goes left on the number line, so for negatives it moves away from zero.

How it is calculated

Floor ⌊x⌋ = largest integer ≤ x; ceiling ⌈x⌉ = smallest integer ≥ x

Truncation = drop the decimals (round toward 0)

Fractional part = x − ⌊x⌋, always between 0 and 1

With a divisor d: work on x/d; remainder = x − d·⌊x/d⌋ (same sign as d)

The principle

On the number line, the floor jumps to the integer at or just to the left of x, and the ceiling to the integer at or just to the right. For positive numbers truncation equals the floor, but for negative numbers it equals the ceiling, because chopping off decimals moves toward zero. That difference matters in programming: some languages' integer division truncates, others floor, and they disagree for negative values.

Worked example

Default inputs: x = −3.7, d = 1.

  1. Value of x/d = −3.7.
  2. Floor ⌊−3.7⌋ = −4 (the next integer down, to the left).
  3. Ceiling ⌈−3.7⌉ = −3; truncation = −3 (toward zero).
  4. Fractional part = −3.7 − (−4) = 0.3; remainder = −3.7 − 1 × (−4) = 0.3.
  5. Whole number? no — the ceiling is the floor + 1.
How Floor ⌊x/d⌋ (round down) changes with Divide by d (use 1 for x itself)How Floor ⌊x/d⌋ changes with Divide by d-15-10-500.250.50.7511.251.52Example: -4Divide by d (use 1 for x itself)
Each point is the calculator re-run with only “Divide by d (use 1 for x itself)” changed; the gold point is the default example. Change the inputs above and this chart follows your numbers.
Divide by d (use 1 for x itself)Floor ⌊x/d⌋ (round down)
0.25-15
0.5-8
0.75-5
1-4
1.25-3
1.5-3
2-2

How to read the result

For packing problems use the ceiling: 23 people in cars of 5 need ⌈23/5⌉ = 5 cars. For "how many full groups" use the floor: ⌊23/5⌋ = 4. The fractional part is never negative under this definition, which surprises people working with negative numbers.

Common mistakes

Keep in mind: Spreadsheets and programming languages name these functions differently and may treat negative numbers differently; check the documentation of the tool you use.

Frequently asked questions

What is the floor of −3.7?

−4, the largest integer not greater than −3.7.

What is the difference between floor and truncate?

They match for positive numbers; for negative numbers truncation rounds toward zero, the floor rounds down.

When do I use the ceiling function?

When you need enough whole units to cover an amount, such as boxes, buses or pages.

Sources: R. L. Graham, D. E. Knuth & O. Patashnik, Concrete Mathematics, 2nd ed. (1994), Ch. 3 Integer Functions

Checked 9 Nov 2026. Weisstein, E. W., “Floor Function”, Wolfram MathWorld (⌊x⌋ is the largest integer ≤ x; ceiling = least integer ≥ x; fractional value x − ⌊x⌋ ∈ [0, 1); integer part sgn(x)⌊|x|⌋ rounds toward zero).

🧮 All math & statistics tools →🌍 Calculators by country →