14,000 hints and counting!

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: jsuen on Dec 12, '05 08:25:54AM

What they teach kids in school is a lie. Rounding 5 up produces a bias, because 5 is exactly in the middle. What you should do is round 5 up half the time, and down the other half. IEEE 754 floating point defines a round to even to do this exactly, so Calculator is correct.

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?

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.

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.
-Dave

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.

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!

Regarding Calculator and low precision values
Authored by: Baggins on Dec 12, '05 08:57:44AM

Sorry to correct you, but you are wrong.

By definition, the LAST digit in the significant figure is the uncertain figure.

So, 13,000 in significant figures simply means that we know the 1 for certain, and know that the 3 is approximate. In other words, the value could be anywhere from 12,000 to 14,000, so you can see that no bias is introduced in rounding.

Regarding Calculator and low precision values
Authored by: jsuen on Dec 12, '05 09:56:53AM

No, thats wrong. If 2 figures are significant, those two figures are exact.

Check out rule 1:
http://dbhs.wvusd.k12.ca.us/webdocs/SigFigs/SigFigRules.html

The site also describes round-to-even.

Regarding Calculator and low precision values
Authored by: Baggins on Dec 12, '05 10:56:55AM

I'm sorry, but the site you linked is incomplete.

Significant figures are used in Physics and Chemistry to specify the accuracy of a measurement. The last digit that is significant is always an approximation or the digit at which error creeps into the measurement.

In strict notation, the significant digits are always followed by an uncertainty value.

For example, 1.234 +/-.002 has four significant figures with an uncertainty of 2 in the last digit. This means the value COULD be anywhere from 1.232 to 1.236. If no error value is listed, then it is assumed the entire digit could be incorrect, meaning the value in our example could be anywhere from 1.230 to 1.239.

A classic example of this at work is when you measure something with a ruler. Assume the ruler is marked to a tenth of an inch. Your significant digits for any measure would be to the hundredth, with the hundredth being an approximation (as judged by your eyeball).

If you were being very precise, you would then add a margin of error and a confidence level to that error. The error simply states you could be off by that amount, and the confidence level is simply the probability that you are right in saying you could be off by your error margin.

When you are performing math where significant digits are involved, the rounding rules are: 0-4 round down, 5-9 round up.

If you still doubt me, go grab a frehsman college text on Chemistry.