Skip to content
thecalculatorstudio

Rounding Calculator: Half Up, Half Even, Floor, Ceiling

Enter a number, the decimal places and a rounding rule. You will see the rounded value, how much it changed, whether the digits dropped were an exact half, and what every other rule would give.

Last reviewed

Rounded to 2 decimal places

2.68

the dropped digits are exactly a half, so the rules differ

Original
2.675
Rounding changed it by
0.005
A tie (exactly a half)?
yes
Every rule for the same number
RuleResult
Half up (away from zero)2.68
Half even (NIST rule)2.68
Half down (towards zero)2.67
Floor (down)2.67
Ceiling (up)2.68
Truncate (towards zero)2.67

Done in exact decimal arithmetic, so 1.005 to two places is 1.01 by half up. Binary floating point stores 1.005 slightly low, which is why some programs give 1.00.

The basic rule

To round a number you keep a chosen number of digits and decide whether the last kept digit goes up. Look at the digits you are about to drop:

  • If they start with less than 5, the last kept digit stays. 2.674 to two decimal places is 2.67.
  • If they start with more than 5, or with a 5 followed by anything other than zeros, the last kept digit goes up by one. 2.676 is 2.68, and 2.6751 is also 2.68.
  • If they are exactly a 5 (a tie), the rules disagree. This is the case the page spends most of its time on.

NIST’s guide to the SI states the first two in these words, with the examples that 6.9749515 rounded to 3 digits is 6.97, and to 5 digits is 6.9750.

Ties: the six rules

When the digits dropped are exactly a half, the number sits exactly between two candidates. Different rules pick differently:

Rule A tie goes… 2.5 3.5 −2.5
Half up (away from zero) to the larger size 3 4 −3
Half even to the even neighbour 2 4 −2
Half down (towards zero) to the smaller size 2 3 −2
Floor always down 2 3 −3
Ceiling always up 3 4 −2
Truncate digits simply dropped 2 3 −2

The last three do not distinguish ties at all: floor and ceiling push every number the same way, and truncation drops the digits. Floor and ceiling are what programming languages usually mean by those names, and truncation is rounding towards zero.

Half up is what is taught at school. Half even is the rule in NIST’s guide: if the digits to be dropped begin with a 5 and all the following digits are 0, the digit before the 5 is unchanged if it is even and increased by 1 if it is odd, so the last digit is always even. It is also called banker’s rounding, because it removes a bias: with half up, ties always move away from zero, and a column of many numbers ending in 5 adds up too high.

Worked examples

2.675 to two places. The digits dropped are exactly 5. Half up gives 2.68. Half even also gives 2.68, because the digit 7 is odd and so goes up to the even 8. Half down gives 2.67.

2.665 to two places. Half up gives 2.67, but half even gives 2.66, because 6 is already even.

The NIST examples. 6.9749515 to six decimal places is a tie, with the digit 1 odd, so half even gives 6.974952. 6.9749505 to six places is a tie with the digit 0 even, so it stays 6.974950.

To tens and hundreds. Negative places do this. 1,234.567 to the nearest hundred is 1,200, to the nearest ten 1,230, and to the nearest thousand 1,000. With ceiling it becomes 1,300 and 2,000. 2,500 to the nearest thousand is a tie: half up gives 3,000 and half even gives 2,000.

Negative numbers. −2.5 to a whole number is −3 by half up (away from zero) but −2 by half down and half even. Floor takes it down to −3 and ceiling up to −2.

Why 1.005 is a good test

Many spreadsheets and programs round 1.005 to 1.00 rather than 1.01. They store numbers in binary floating point, which cannot hold 1.005 exactly: the closest value is 1.00499999999999989…, below the tie, so the program rounds it down. This page works in exact decimal arithmetic, so it sees 1.005 as exactly 1.005, treats it as a tie, and half up gives 1.01 (half even gives 1.00, because 0 is even). If you are checking someone else’s rounding, this is the first case to try.

Rounding errors add up

Rounding at each step and adding gives a different answer from adding first. Three prices of 1.004 each total 3.012, which is 3.01. Rounded one by one they are 1.00, 1.00, 1.00, which total 3.00. For accounts, keep the full figures through the sum and round once at the end. The page also shows how much each rounding changed the number, so you can see the error you are accepting.

When to use which rule

  • Half up: everyday rounding, shop prices, school work.
  • Half even: science and engineering where many values are averaged or summed, and wherever a standard (such as NIST’s) asks for it.
  • Floor: counting whole units you can fill, such as the whole boxes you can pack. See also significant figures for rounding to a number of meaningful digits.
  • Ceiling: how many whole units you must buy to cover something, such as tiles or buses.
  • Truncate: cutting digits off, as when a calculator or programme shows a number without rounding.

Common mistakes

  • Rounding twice. Rounding 2.449 to 2.45 and then to 2.5 gives the wrong answer; 2.449 is 2.4 to one place. Always round from the original number.
  • Looking at the wrong digit. Only the first dropped digit (and whether more non-zero digits follow a 5) matters.
  • Assuming 5 always rounds up. Under half even a tie can go down.
  • Rounding a sum of rounded numbers. Round once, at the end.
  • Getting negative numbers backwards. Half up goes away from zero, so −2.5 becomes −3.

How it is calculated

The number is read as the exact decimal you typed. It is multiplied by 10 to the power of the places, rounded to a whole number by the chosen rule in 60-digit decimal arithmetic, and divided back. A tie is detected when the scaled number’s fractional part is exactly one half. The page writes the result with the places asked for, never as −0, and reports the exact difference between the rounded and the original number.

Frequently asked questions

How do you round a number?

Look at the first digit you are dropping. If it is less than 5, leave the last kept digit as it is. If it is more than 5, or a 5 followed by non-zero digits, raise the last kept digit by 1. 2.674 to two places is 2.67 and 2.676 is 2.68.

What happens when the digit is exactly 5?

That is a tie, and the rules differ. Half up always goes to the larger size (2.5 becomes 3). Half even goes to the even neighbour (2.5 becomes 2 and 3.5 becomes 4), which is the rule NIST gives. The page shows all of them.

What is banker's rounding?

Another name for round half to even. A tie goes to the nearest even digit, so ties round up about half the time and down about half the time, which avoids a bias when many numbers are added up.

Why does 1.005 round to 1.00 on some programs and 1.01 here?

Binary floating point cannot hold 1.005 exactly and stores it slightly below, so a program that works in floats rounds it down. This page uses exact decimal arithmetic, so 1.005 is treated as a tie and goes to 1.01 by half up.

How do I round to the nearest ten or hundred?

Use negative places. -1 rounds to the nearest 10, -2 to the nearest 100 and -3 to the nearest 1,000. 1,234.567 to the nearest hundred is 1,200.

What is the difference between rounding, floor, ceiling and truncating?

Rounding goes to the nearest value. Floor always goes down and ceiling always up, towards minus and plus infinity. Truncating just drops the digits, which for negative numbers means towards zero.

Related calculators

Sources