# Rules for rounding (positive and negative numbers)

I'm looking for clear mathematical rules on rounding a number to $n$ decimal places.

Everything seems perfectly clear for positive numbers. Here is for example what I found on math.about.com :

Rule One Determine what your rounding digit is and look to the right side of it. If that digit is $4, 3, 2, 1,$ or $0$, simply drop all digits to the right of it.

Rule Two Determine what your rounding digit is and look to the right side of it. If that digit is $5, 6, 7, 8,$ or $9$ add $1$ to the rounding digit and drop all digits to the right of it.

But what about negative numbers ? Do I apply the same rules as above ?

For instance, what is the correct result when rounding $-1.24$ to $1$ decimal place ? $-1.3$ or $-1.2$ ?

• -124? Do you mean -1.24? Aug 27 '10 at 6:38
• oops ! you're right, I corrected my question ! thx ! Aug 27 '10 at 6:42
• This doesn't directly answer your question, but you might be interested in some of the rounding techniques posited at wikipedia: en.wikipedia.org/wiki/Rounding#Rounding_to_integer Of course, you'd have to scale your results appropriately to deal with non-integer rounding. Aug 27 '10 at 7:42
• Yonatan: Most of the disagreement anyway is how to handle the case when the digit after the rounding digit is a 5; for the other digits, all seem to be in agreement. I guess the rules are application-dependent! Aug 27 '10 at 10:32
• You can round however you like. If there is a technical circumstance where a specific rounding method is needed it should be clear that this is the case.
– anon
Aug 27 '10 at 17:05

"Round to nearest integer" is completely unambiguous, except when the fractional part of the number to be rounded happens to be exactly $\frac 1 2$. In that case, some kind of tie-breaking rule must be used. Wikipedia (currently) lists six deterministic tie-breaking rules in more or less common use:

• Round $\frac 1 2$ up
• Round $\frac 1 2$ down
• Round $\frac 1 2$ away from zero
• Round $\frac 1 2$ towards zero
• Round $\frac 1 2$ to nearest even number
• Round $\frac 1 2$ to nearest odd number

Of these, I'm personally rather fond of "round $\frac 1 2$ to nearest even number", also known as "bankers' rounding". It's also the default rounding rule for IEEE 754 floating-point arithmetic as used by most modern computers. According to that rule,

\begin{aligned} 0.5 &\approx 0 & 1.5 &\approx 2 & 2.5 &\approx 2 & 3.5 &\approx 4 \\ -0.5 &\approx 0 & -1.5 &\approx -2 & -2.5 &\approx -2 & -3.5 &\approx -4. \\ \end{aligned}

• I asked OP to unaccept my answer. Aug 30 '11 at 14:07
• 2.5 ≈ 2? Really?? Apr 8 '16 at 9:02
• @DonkeyKong yes. wolframalpha.com/input/?i=round(2.5)
– plhn
Aug 5 '16 at 9:14
• This doesn't answer the question, it just prescribes your favorite rounding method.... (and what "others"? Yours is the sole answer to the question) Apr 25 '17 at 1:14
• @user3932000: Back when I posted this, there were several other answers and, IIRC, comments pointing out that "round to nearest" is only ambiguous if the input number is exactly halfway between two round numbers. Apparently, most of these have since been deleted, although some still remain. Also, the note at the end about my personal preference for "round to even" is just an addendum; the "meat" of the answer is in the first paragraph and the following list. I suppose I could add some examples for the other tie-breaking methods, too. Apr 25 '17 at 11:39

Out of the six methods described in Ilmari's answer, one has two noticeable advantages: the "round away from zero" rule.

1. We only need to look at a single place to determine which direction to round to.

When faced with e.g. 0.15X where X could be any digit, we don't need to concern ourselves with what X might be when rounding to 1 decimal place. If X is zero then the rule tells us to round to 0.2 and if it is non-zero then we would round to 0.2 anyway.

This also applies with the "round up" rule, but only for positive numbers. Any of the other rules could require us to examine X to determine whether or not we should round to 0.1 or 0.2.

This advantage holds true for negative numbers with the "round away from zero" rule. -0.15X will always round to -0.2 regardless of X. This works with the "round down" and "round towards zero" rule for negative numbers, but not any other rule.

"Round away from zero" is the only rule that has this benefit for both positive and negative numbers.

1. Lack of bias

With the "round away from zero" rule, half of all numbers will be rounded up and half rounded down when the digit 5 is encountered. This means that for a random selection of numbers that you round to the same place, the exepcted average amount that you will round by is 0. This is because every digit that you round down is paired with a digit that you will round up (amount rounded in brackets):

1 9 (-1 +1)
2 8 (-2 +2)
3 7 (-3 +3)
4 6 (-4 +4)
5 5 (-5 +5) <-- for negative and positive numbers respectively


This advantage exists with some of the other rules, but with the others you lose the first advantage. With "round up" or "round down" you introduce a bias because the digit 5 will always result in a +5 or a -5 respectively.

Note that this only works if you expect to encounter positive and negative numbers with equal probability.

• Re: bias, that's the reason for the "banker's rounding" (round to nearest even) strategy; when you're faced with only (or at least primarily) positive numbers, the "away from zero" bias can add up over time. "Round to nearest even" avoids introducing bias even if all your values are positive, as long as they're distributed equally across evens and odds. (It also avoids bias when you have an equal mix of positives and negatives, of course.) Nov 11 '20 at 18:12