Brain Burp Rounding??
David W. Gulley email (remove spam text)
Roman Black wrote:
Cept for one minor detail,
There are 999 values BETWEEN 0 and 1000.
500 IS the halfway point.
500 values below it (0 - 499) and
500 values above it (501 - 1000).
Therefore, if accumulating a large series of "random" numbers and
rounding using the 5 or greater rule, the result will "tend" to be too
large since statistically you are using 500 possibilities below the
number and 499 above the number.
For most things this error would probably not be a problem, but the
"round to even if 5" rule will "tend" to average out the error
accumulation at the expense of complicating the rule slightly.
The validity of the least significant digits does play an important role
in the process, so when absolute accuracy is required use a tolerance
(+/-) to exactly specify the values, and the error accumulation.
For example (round to nearest 1/100):
Value Tolerance Round >=5 Round to Even if 5
1.125 +/- 0.005 1.13 1.12
1.135 +/- 0.005 1.14 1.14
Repeat above 1000 times and Total
2260 2270 2260
when the tolerances say:
2260 +/- 10 or somewhere in the range of 2250 to 2270 so yes the
"Round >=5" is a 'correct' answer (since it is in the possible range
defined by the tolerances, even if it is at the upper limit), but the
2260 provided by the "Round to even if 5" is a 'better' answer (in some
Obviously this is a contrived scenerio, but if a particular sensor
reported to 0.5 units of precision with +/- 0.5 units of accuracy, and
you wanted to accumulate readings over a long interval, the "Round >=5"
will provide an answer that is "typically" too large.
If you were buying gasoline, and the pumps all rounded using the "Round
>=5" rule, would you mind that you were charged for 2270 gallons instead of 2260? :-)
As I stated in an earlier message in this thread,
This is a very debatable subject!
David W. Gulley
http://www.piclist.com hint: To leave the PICList
See also: www.piclist.com/techref/index.htm?key=brain+burp+rounding
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the