Ceiling and Floor Function Calculator screenshot

Ceiling and Floor Function Calculator

Get the floor, ceiling and truncated value of a decimal exactly, read from the digits rather than from a float.

Privacy First
0 Runs
Updated 2026-11-22
No upload
Instant
No signup

Ceiling and Floor Function Calculator

Get the floor, ceiling and truncated value of a decimal exactly, read from the digits rather than from a float.

How this page computes

The page compares the digit strings directly, so no binary floating-point rounding can change the answer. That matters at values such as minus 0.5, where the floor is minus 1 and truncation is 0.

The calculation runs entirely in this browser tab; nothing is uploaded.

The page reads a decimal as text and reports its floor, its ceiling and its truncation. For minus 2.3 the floor is minus 3, the ceiling is minus 2 and the truncation is minus 2.

Because the digits are read directly, a value with many decimal places is not first rounded by the browser. A whole number returns itself for all three values, and the page says so instead of implying a fractional part.

How to use the Ceiling and Floor Function Calculator

Enter a decimal number such as 4.7 or -2.3 and press Run. The first three lines are the floor, the ceiling and the truncated value.

The last line states whether the input had a non-zero fractional part. Up to thirty decimal places are read exactly; a longer value is refused with the limit named.

The rule this page applies

The floor is the greatest whole number not above the value, and the ceiling is the least whole number not below it. Truncation moves toward zero, which differs from the floor for negative values.

The page compares the digit strings directly, so no binary floating-point rounding can change the answer. That matters at values such as minus 0.5, where the floor is minus 1 and truncation is 0.

What to Expect

Best for

  • Checking floor and ceiling of a negative decimal
  • Seeing the difference between floor and truncation
  • Rounding an exact decimal

Not ideal for

  • Rounding to a chosen number of places
  • Decimal values with more than thirty places
  • Fractions written with a slash

What this tool keeps

  • The exact decimal digits that were read

What may need cleanup

  • Nothing: all three values are exact

Common errors

  • A value with a letter is refused by name
  • More than thirty decimal places is refused with the limit named

Example use cases

  • Check minus 2.3
  • See minus 0.5 floor to minus 1

Sample input

-2.3

Sample output

floor = -3 ceiling = -2 truncated = -2 the value is not a whole number

Who this is for

  • Students learning floor and ceiling
  • Programmers checking a rounding edge case

Frequently asked questions

Why is the floor of minus 2.3 minus 3?

The floor is the greatest whole number not above the value. Minus 3 is below minus 2.3 and minus 2 is above it, so minus 3 is the floor.

How is truncation different?

Truncation discards the fractional digits and moves toward zero, so minus 2.3 truncates to minus 2. The page prints both so the difference is visible rather than assumed.

Does the page use floating point?

No. It parses the sign, the whole digits and the fractional digits separately, so the answer is decided by the text you typed rather than by a binary approximation.

Is anything uploaded?

Nothing is uploaded. The numbers are read and the arithmetic runs in this browser tab with JavaScript, and reloading the page discards both the input and the result.

Developer program

Build custom tools for your store

Join the SDK program to create useful ecommerce utilities for your store.