Floor and Ceiling Calculator

Enter a number to find its floor, ceiling, rounded, and truncated values.

How it is calculated

For one number x the tool returns four whole numbers. Floor ⌊x⌋ is the largest integer that is not greater than x. Ceiling ⌈x⌉ is the smallest integer that is not less than x. Rounded goes to the nearest integer, with exact halves moving away from zero (2.5 gives 3 and -2.5 gives -3). Truncated simply drops the decimals, which moves toward zero.

For a whole number all four results are equal. For positive x, floor and truncated agree; for negative x, ceiling and truncated agree. Results are shown without decimals and with locale thousands separators. Numbers of 9,007,199,254,740,992 (253) or more in size return no result, because decimals can no longer be represented exactly there. Enter the decimal point as a dot.

Worked example

Take x = -4.7, which lies between -5 and -4. The floor is the integer below it, -5. The ceiling is the integer above it, -4. Rounding goes to the nearest integer; -4.7 is closer to -5 than to -4, so rounded is -5. Truncation drops .7 and keeps -4. So floor and rounded give -5, while ceiling and truncated give -4. For the positive 4.7 the floor and truncated values would both be 4 instead.

Try this example →

Common mistakes

  • Assuming floor and truncation are the same for negative numbers: floor(-4.7) is -5, but truncating gives -4. They only agree for numbers at or above zero.
  • Expecting a negative number such as -0.3 to give a ceiling of -0 or 1: the ceiling and truncated values both show 0, while the floor is -1.
  • Expecting .5 to round to the nearest even number (banker's rounding): this tool rounds halves away from zero, so 2.5 becomes 3 and -2.5 becomes -3, which can differ from a spreadsheet or language that uses even rounding.
  • Using the rounded value for counts that cannot be short: for the number of pages, boxes or trucks needed, you want the ceiling, and rounding 0.3 gives 0 while the ceiling gives 1.
  • Typing a decimal comma such as -4,7: only the dot is read as the decimal point, and the tool returns no result for the comma form.

About this calculator

The floor and ceiling calculator returns four related values for any number: the floor ⌊x⌋ (the greatest integer less than or equal to x), the ceiling ⌈x⌉ (the smallest integer greater than or equal to x), the conventionally rounded value, and the truncated value (the integer part with the decimal simply dropped). For a positive number like 4.7, floor and truncation agree (both give 4), but for negatives like −4.7 they part ways — floor(−4.7) = −5 while truncation gives −4.

The distinction matters constantly in programming and quantitative work: pagination logic uses ceiling to make sure a partial page still gets its own page, batch-sizing and inventory calculations use floor or ceiling depending on whether you're allowed to round up, and languages like Python, JavaScript, and SQL don't all implement integer division consistently. Developers, students learning discrete math, and anyone auditing a spreadsheet formula use this tool to check exactly what a given rounding function will output before relying on it in code.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    Negative numbers are where floor, ceiling and truncation part ways. For -2.5 the floor is -3, the ceiling is -2, rounding goes away from zero to -3 and truncation gives -2. This matters in code, since integer division in some languages floors and in others truncates, so the same expression can differ for negative values. Which language or spreadsheet function are you matching against this output?

Popular calculators

All Calculators