Math
Floor and Ceiling Calculator
Type any number to get its floor (the greatest integer at or below it), its ceiling (the least integer at or above it), the truncated value, the rounded value, and the fractional part, with a number-line description of where the number sits.
Negative decimals are the classic trap, so -2.3 is shown floored to -3 and ceilinged to -2 with the reasoning. The division mode computes ⌊a ÷ b⌋, ⌈a ÷ b⌉, and a mod b for two integers exactly.
Any real number. Decimals and negatives are handled exactly.
Try an example
Result
Floor ⌊x⌋
—
- Ceiling ⌈x⌉
- —
- Rounded (half away from zero)
- —
- Truncated (toward zero)
- —
- Fractional part x - ⌊x⌋
- —
- Remainder a mod b
- —
Student quick launch
Grade planning, algebra checks, and formulas students reach for most.
Study path
Use this calculator with
Follow these when you want the formula behind the answer, a short lesson, or nearby tools in the same topic.
What the floor and ceiling calculator solves
The floor of x, written ⌊x⌋, is the largest integer that is not bigger than x; the ceiling ⌈x⌉ is the smallest integer that is not smaller than x. For 2.3 they are 2 and 3. For -2.3 they are -3 and -2, which surprises people who expect 'chop the decimals'. Chopping is truncation, a third operation, and rounding to the nearest integer is a fourth. This calculator shows all four so the differences are clear.
| x | Floor ⌊x⌋ | Ceiling ⌈x⌉ | Truncate | Round |
|---|---|---|---|---|
| 2.3 | 2 | 3 | 2 | 2 |
| 2.5 | 2 | 3 | 2 | 3 |
| 2.7 | 2 | 3 | 2 | 3 |
| -2.3 | -3 | -2 | -2 | -2 |
| -2.5 | -3 | -2 | -2 | -3 |
| -2.7 | -3 | -2 | -2 | -3 |
| 4 | 4 | 4 | 4 | 4 |
Reading it on the number line
Picture the integers as ticks. Any non-integer x sits strictly between two ticks: the tick on its left is the floor and the tick on its right is the ceiling, whatever the sign. Truncation moves toward zero, so it equals the floor for positive x and the ceiling for negative x. Rounding picks the closer tick, with ties (.5) going away from zero in classroom rounding.
Floor division and modulo
Floor division ⌊a ÷ b⌋ is the quotient rounded down. Pairing it with the remainder a - b × ⌊a ÷ b⌋ gives the floored The remainder left over after dividing one whole number by another. used in Python and most math courses, where the remainder takes the sign of b. Truncated division (C, Java, JavaScript's %) rounds the quotient toward zero instead, so -17 ÷ 5 gives -4 remainder 3 under floor division but -3 remainder -2 under truncation.
How to use it
- Enter a number (decimals and negatives welcome) and read ⌊x⌋, ⌈x⌉, the truncated and rounded values, and the fractional part.
- For two integers, choose the division mode to get ⌊a ÷ b⌋, ⌈a ÷ b⌉, the truncated quotient, and the remainder.
- Open Show the work for the number-line placement and each definition applied.
How to read the answer
Floor and ceiling always straddle x: floor ≤ x ≤ ceiling, and they are equal only when x is already an integer. The fractional part is x minus the floor, so it is between 0 and 1 even for negatives (-2.3 - (-3) = 0.7). In division mode the floored remainder is never negative for a positive divisor, and a = b × quotient + remainder holds exactly.
Common mistakes and edge cases
- Saying ⌊-2.3⌋ = -2. Rounding down means toward negative infinity, so it is -3.
- Assuming truncation equals floor; they agree for positives but differ for negatives.
- Rounding 2.5 to 2 in a math class that uses half-away-from-zero (it rounds to 3); some software rounds half to even.
- Using floor division with decimals and expecting a whole remainder; divide first, then floor.
- Dividing by zero in the division mode: the floor of an undefined quotient is undefined.
Worked examples
Negative decimal
⌊-2.3⌋ = -3, ⌈-2.3⌉ = -2.
Floor ⌊x⌋
-3
Positive decimal
⌊7.85⌋ = 7.
Floor ⌊x⌋
7
Integer input
Floor and ceiling coincide.
Floor ⌊x⌋
4
Exact half
⌊-2.5⌋ = -3, rounds to -3 (away from zero).
Floor ⌊x⌋
-3
Zero
Everything is 0.
Floor ⌊x⌋
0
Floor division -17 ÷ 5
⌊-3.4⌋ = -4, remainder 3.
Floor ⌊x⌋
-4
Floor division 17 ÷ 5
⌊3.4⌋ = 3, remainder 2.
Floor ⌊x⌋
3
Division by zero
Undefined.
Floor ⌊x⌋
Error
Frequently asked questions
What is the floor of a number?+
The greatest integer less than or equal to it: ⌊3.9⌋ = 3, ⌊-3.9⌋ = -4, ⌊5⌋ = 5. It is also called the greatest integer function or int().
What is the ceiling of a number?+
The least integer greater than or equal to it: ⌈3.1⌉ = 4, ⌈-3.1⌉ = -3, ⌈5⌉ = 5.
What is the floor of a negative decimal?+
The integer farther from zero. ⌊-2.3⌋ = -3 because -3 is the largest integer that does not exceed -2.3.
How are floor, truncate, and round different?+
Floor goes toward -∞, truncate goes toward 0, and round goes to the nearest integer. For 2.7 they give 2, 2, 3; for -2.7 they give -3, -2, -3.
What is floor division?+
The quotient rounded down: -17 // 5 = -4 in Python because ⌊-3.4⌋ = -4. The matching remainder is -17 - 5 × (-4) = 3.
Why does JavaScript give -17 % 5 = -2?+
JavaScript truncates the quotient toward zero (-3), so the remainder is -17 - 5 × (-3) = -2. Python and math classes floor the quotient to -4 and get remainder 3.
What is the fractional part of a negative number?+
x - ⌊x⌋, which is always between 0 and 1: for -2.3 it is -2.3 - (-3) = 0.7.
About this calculator
- Written by
- mathcheck editorial team
- Last reviewed
- September 4, 2026
Method
- Uses the values entered by the user and stable formulas documented on the page.
Related calculators
Rounding Calculator
Round numbers to any place value or to significant figures with five rounding methods, exact tie handling, both neighbor candidates, and the rounding error shown.
Modulo Calculator
Find a mod n for integers, negative numbers, and decimals with the quotient, remainder, division equation, congruence class, clock visual, and a clear explanation of floored vs truncated remainders.
Remainder Calculator
Divide two whole numbers and get the quotient and remainder, the check equation a = b × q + r, the mixed-number, fraction, and decimal forms of the same division, and both sign conventions for negatives.
Absolute Value Calculator
Find |x| for any number with the number-line meaning, the distance |a - b| between two numbers, or solve absolute value equations |ax + b| = c by splitting into two cases, all with steps.
Long Division Calculator
Divide whole numbers with every classic long-division step shown — divide, multiply, subtract, bring down — plus quotient, remainder, decimal answer, and a check line.
Eigenvalues and Eigenvectors Calculator
Find the eigenvalues and eigenvectors of a square matrix up to 8 x 8. Shows the characteristic polynomial, exact eigenvalues (including fractions, square roots, and complex pairs), eigenvector bases, multiplicities, and whether the matrix is diagonalizable.
Last updated: September 4, 2026