Rounding Calculator
With number 2.5, decimal places 0, rounding comes to 3.000000 — rounded. It is reached in 6 steps, the last of which is floor(2.5 + 0.5) / 1, and each one is printed on the page with its numbers filled in. The formula is the one published by IEEE 754, not an approximation fitted to it.
A number rounded every way there is — half up, half to even, down, up and truncated — with the ones that disagree shown together.
Formula and sources checked · How we check
Number 2.5
3.000000
Rounded for the example below. Editing a field recomputes the calculator below; this figure holds the answer the page was loaded with.
It is written into the HTML rather than drawn by a script, so a search engine reading this page without running JavaScript still finds an answer.
- Half up — 2.5 goes to 3
floor(2.5 + 0.5) / 13- Half to even — 2.5 goes to 2
(round(2.5 / 2) * 2) / 12- Down, toward minus infinity
floor(2.5) / 12- Up, toward plus infinity
ceil(2.5) / 13- Truncated, toward zero
fix(2.5) / 12- The methods disagree here
1
Worked example
2.5 rounds to 3 by the rule taught in school and to 2 by the rule your computer uses. Both are correct and they are different conventions: round-half-to-even exists because always rounding .5 upward biases a long column of figures upward with it.
How to work it out yourself
- 1.Enter the number and how many decimal places you want. Negative places round to tens, hundreds and thousands.
- 2.Read the two half rules together where they disagree. Which one applies is a matter of what the number is for, not of which is more accurate.
- 3.Truncation is not rounding: it drops what is past the cut whatever it is, so 7.99 becomes 7. It is what a computer does when it converts a decimal to a whole number without being asked to round.
Where the two half rules part company
| Number | Rounded | Half to even — 2.5 goes to 2 | Truncated, toward zero |
|---|---|---|---|
| 0.5 | 1.000000 | 0 | 0 |
| 1.5 | 2.000000 | 2 | 1 |
| 2.5 | 3.000000 | 2 | 2 |
| 3.5 | 4.000000 | 4 | 3 |
| 4.5 | 5.000000 | 4 | 4 |
| 5.5 | 6.000000 | 6 | 5 |
| 6.5 | 7.000000 | 6 | 6 |
| 7.5 | 8.000000 | 8 | 7 |
| 8.5 | 9.000000 | 8 | 8 |
| 9.5 | 10.000000 | 10 | 9 |
Rounded to whole numbers. Half up always goes away from zero; half to even alternates.
The formula
- Half up — 2.5 goes to 3
floor(2.5 + 0.5) / 1 - Half to even — 2.5 goes to 2
(round(2.5 / 2) * 2) / 1 - Down, toward minus infinity
floor(2.5) / 1 - Up, toward plus infinity
ceil(2.5) / 1 - Truncated, toward zero
fix(2.5) / 1 - The methods disagree here
Source: IEEE 754 — Standard for Floating-Point Arithmetic (round-to-nearest-even is the default mode), NIST Special Publication 811 — Guide for the Use of the International System of Units
Questions people actually ask
- What is bankers’ rounding?
- Round half to even: when a value sits exactly on the halfway point, it goes to whichever neighbour is even. 2.5 becomes 2, 3.5 becomes 4. Over a long column it removes the upward bias that always-round-up introduces, which is why it is the IEEE 754 default and the behaviour of most financial and scientific software.
- Why does my spreadsheet round differently from my code?
- Because they use different rules. Excel’s ROUND function rounds half away from zero; Python’s built-in round and most C libraries round half to even; JavaScript’s Math.round rounds half toward positive infinity, so it turns −2.5 into −2 rather than −3. All three are defensible and none of them is a bug.
- Does rounding twice give the same answer?
- Not always, and the failure is worth knowing about. Round 8.44 to one decimal and you get 8.4; round that to a whole number and you get 8, which is what rounding 8.44 directly gives too. But 8.45 rounded twice climbs to 9 while rounding it once leaves 8. Round once, from the original figure.
- How do I round to the nearest hundred?
- Use −2 decimal places. The scale factor becomes 0.01, so 1,250 rounds to 1,300 under half up and 1,200 under half to even. Negative places are the same arithmetic running the other way, and they are how a rounding function handles orders of magnitude.
Related
- Percentage CalculatorWhat X% of a number is, plus the discounted price, the marked-up price and the remainder.
- Fraction to Decimal CalculatorConverts fractions to decimals and back, to the nearest 16th, 32nd and 64th, with the millimeter equivalent.
- Exponent CalculatorA number raised to any power, including negative and fractional ones, with the root it is equivalent to and the answer in scientific notation.
- Resistor Colour Code CalculatorResistance and tolerance from the bands on a resistor, with the E-series value it is meant to be.
- Scientific Notation ConverterA number in scientific, engineering and plain notation at once, with its order of magnitude and significant figures.
- Percent Error CalculatorPercent error against a known value, with percent difference beside it — they are different questions and get confused constantly.
Where this one stops
Put this calculator on your site
Free, no attribution required beyond the link.
<iframe src="https://rulecalculators.com/embed/rounding" width="100%" height="420" style="border:1px solid #e7e4de;border-radius:12px" title="Rounding Calculator"></iframe>