What is the Rounding Calculator?
The Rounding Calculator takes any number and rounds it to a chosen number of decimal places. Beyond standard "round to nearest," it also supports ceiling (always up), floor (always down) and truncation (drop digits toward zero). It's handy for finance, statistics, engineering, schoolwork, and cleaning up messy measurements.
How to use it
Enter the number you want to round, choose how many decimal places to keep, and pick a rounding mode. Positive decimal places keep digits after the point (2 → hundredths). A value of 0 rounds to a whole number, and negative values round to the left of the decimal point: −1 rounds to the nearest ten, −2 to the nearest hundred.
The formula explained
Rounding to d decimal places works in three steps. First multiply by \(10^{d}\) to shift the digits you want to keep to the left of the decimal point. Then round that scaled value to the nearest integer. Finally divide by \(10^{d}\) to shift back. In symbols: $$\text{rounded} = \frac{\operatorname{round}(x \times 10^{d})}{10^{d}}$$ The "nearest" mode rounds halves up (3.145 → 3.15), while ceiling, floor and truncate replace the rounding step with ceil, floor, or drop-toward-zero.
Worked example
Round 3.14159 to 2 decimal places. Multiply: \(3.14159 \times 10^{2} = 314.159\). Round to the nearest integer: 314. Divide back: \(314 \div 100 = \mathbf{3.14}\). Now try −1 decimal place on 1234: \(1234 \times 10^{-1} = 123.4\), round → 123, \(\div\, 0.1 \to \mathbf{1230}\).
How the Four Rounding Modes Compare
All four modes answer the same question — "which multiple of \(10^{-d}\) should replace this number?" — but they break the tie in different directions. Nearest picks the closest multiple and, on an exact half, moves away from zero. Ceiling always moves toward \(+\infty\), floor always moves toward \(-\infty\), and truncate always moves toward zero by simply cutting the extra digits off. For positive numbers ceiling behaves like "always up" and floor behaves like truncate; for negative numbers those pairings swap, which is where most real-world rounding bugs come from.
| Input | Decimal places (d) | Nearest (half away from zero) | Ceiling | Floor | Truncate |
|---|---|---|---|---|---|
| 2.5 | 0 | 3 | 3 | 2 | 2 |
| 2.4 | 0 | 2 | 3 | 2 | 2 |
| 3.145 | 2 | 3.15 | 3.15 | 3.14 | 3.14 |
| −2.3 | 0 | −2 | −2 | −3 | −2 |
| −2.5 | 0 | −3 | −2 | −3 | −2 |
| 1234 | −2 (nearest hundred) | 1200 | 1300 | 1200 | 1200 |
The negative rows: floor ≠ truncate
Look at the −2.3 and −2.5 rows. Truncate deletes the fractional part and leaves −2, because −2 is the neighbour closer to zero. Floor must go to the neighbour that is lower on the number line, which is −3. The two modes agree on every non-negative input and disagree on every negative input that is not already a whole multiple — so code that uses integer truncation where floor was intended (or vice versa) can look perfectly correct until the first negative value arrives.
The exact-half rows: nearest rounds away from zero
2.5 and −2.5 sit exactly halfway between two candidates, so "closest" does not decide anything. This calculator's nearest mode applies round half away from zero: the magnitude is rounded up, giving 2.5 → 3 and −2.5 → −3. The result is symmetric about zero, which is why it matches the rule taught in most school curricula and used by spreadsheet ROUND functions. It is not what banker's rounding would give (2.5 → 2, −2.5 → −2), and it is not what a plain "always add 0.5 then floor" rule gives for negatives (that rule would send −2.5 to −2).
One practical caveat on the 3.145 row: decimal fractions such as 3.145 cannot be stored exactly in binary floating point, so a value that looks like an exact half may actually be stored a hair below or above it. When a tie must be resolved a specific way for legal or accounting reasons, work in a decimal type or an integer number of cents rather than relying on a floating-point tie-break.
The 1234 row shows that a negative number of decimal places rounds to the left of the decimal point: \(d=-2\) means the step is \(10^{2}=100\), so the answer is a whole number of hundreds.
FAQ
How are exact halves handled? In the default nearest mode, a trailing .5 rounds up (away from zero for positives), e.g. 2.5 → 3.
What does a negative decimal place do? It rounds to tens, hundreds and so on. −2 rounds 1567 to 1600.
What is the difference between floor and truncate? For positive numbers they match, but for negatives floor goes more negative (−2.3 → −3) while truncate drops the fraction toward zero (−2.3 → −2).