# 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,$ or $1$, 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 one 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? –  KennyTM Aug 27 '10 at 6:38
oops ! you're right, I corrected my question ! thx ! –  Jérôme 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. –  Yonatan N 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

As others have noted, "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}

-
+1 for the nice explanation I was not aware of. –  Américo Tavares Aug 30 '11 at 13:54
I asked OP to unaccept my answer. –  Américo Tavares Aug 30 '11 at 14:07