Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Regarding Calculator and low precision values' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Regarding Calculator and low precision values
Authored by: pub3abn on Dec 12, '05 08:48:09AM

But doesn't that produce a bias towards even numbers?

[ Reply to This | # ]
Regarding Calculator and low precision values
Authored by: jsuen on Dec 12, '05 09:59:36AM

Whether a number is odd or even is usually not as important as the magnitude of the error. For example, 5.5+3.5+2.5=11. If we round 5 up, we get 6+4+3=13. If we round to even, we get 6+4+2=12. The effect only appears on longer chains of numbers, where the bias of 5 adds up.

Round to even is done on any modern processor. The IRS doesn't care whether your income is odd or even, but they do care if you're $1,000 off.

[ Reply to This | # ]
Regarding Calculator and low precision values
Authored by: dhirsch226 on Dec 12, '05 12:20:19PM

Under what conditions would you conceivably care about a bias towards even numbers? The main issue is usually whether some measure, the mean for example, becomes biased by rounding. That's what round-to-even is for.
You can test this yourself in Excel (or write a simple program):

Cell A1 - Random number. "=RAND()"
Cell B1 - Truncated to 3 decimal places. "=TRUNC(A1,3)"
Cell C1 - Gives first two decimal places as an integer. "=TRUNC(B1*100)"
Cell D1 - Gives third decimal place as an integer. "=10*(B1*100 - C1)"
Cell E1 - Gives the regular rounded value (up on 5). Note that we do this by hand so we don't have to wonder what Excel is doing under the hood. "=IF(D1<5, C1,C1+1)/100"
Cell F1 - Gives a value in which we round down on 5 all the time. "=IF(D1<=5, C1,C1+1)/100"
Cell G1 - Gives a value in which we round to even. "=IF(ISEVEN(C1),F1,E1)"

If you copy this row down on a large number of rows (say, highlight A1 to G10000 and select Edit>Fill>Down), then calculate the averages of each column, you will find that the average for rounding up (Column E) is elevated relative to the average of the truncated values (Column B), while the average for the Round-to-Even values (Column G) is approximately equal to the original values.

Hope this illuminates things. It's always best to test these things yourself.

[ Reply to This | # ]
Regarding Calculator and low precision values
Authored by: JonathanBoyd on Dec 12, '05 03:19:31PM

The bias to even numbers would change the shape of the distribution.

I concede that rounding up does increase the mean. However, it only increases the magnitude of the mean. As numbers are shifted away from zero by rounding up, things should balance out when there are both positive and negative numbers.

The rounding to even method would seem to give a better mean where odd and even numbers are of the same sign. Rounding away from zero gives a better mean where odd and even numbers are of opposing signs. Admittedly, the former is a more likely set of data.

Either way, there are inaccuracies, so I'm sure we can all agree that, the error for any result should be given. Especially if using Apple's calculator.

[ Reply to This | # ]
The distribution only matters if
Authored by: porkchop_d_clown on Dec 12, '05 09:40:49PM
you're doing statistics. If you're doing any other branch of math you want to minimize the total error - the distribution is irrelevant.
Rounding towards even minimizes the total error and is the mechanism used internally by most math chips, IIRC.
Here's a link that refers to both methods as "equally valid".

Everyone loves a clown, but no one will lend him money!

[ Reply to This | # ]