www.piclist.com/techref/index.htm?key=brain+burp+rounding

It seems that we have broken into two camps, the "Always Round Up-ers"

(ARU) and the "Round to Even Crew" (REC). Being a member of the latter

camp, I'm going to try my hand at explaining our stance.

I've been watching everyone go back and forth, arguing if 5 is the

mid-point between 0 and 9 (REC) or if it's part of the upper half of the

set (ARU). Of course it is part of the upper half of the set

{0,1,2,3,4,5,6,7,8,9}. The confusion comes in at this point: The

round-to-even method is meant to minimize rounding error. When 0 is the

digit under consideration, there IS no rounding error introduced. Before

the flames head my way, let me elaborate.

We all agree on this point: when you decide to round a number you first

decide how many digits you want in the final answer, then you throw away

all but one plus that number of digits:

Example: 13.1032

If I decide that I want to report my answer with only one decimal place. I

truncate, leaving 13.10 Now we have to ask, "What does this value mean?"

Putting this value into words, it means "I have exactly 13.1, and it what

appears to be 0 in the hundredths place." When I "round" this number to

13.1, I have not introduced any further error, merely reduced the

precision.

Example: 13.1132 to the tenths place, I start with 13.11, which means "I

have exactly 13.1, and what appears to be 1 in the hundredths place." When

I truncate this value, I have reported the value as less than I have

observed it to be. Hence the "rounding error". The same happens when you

round up.

Looking at the error inducing numbers: {1,2,3,4,5,6,7,8,9}, it becomes

obvious why we call 5 the mid-point of this set. If we always round up at

five, we are putting a positive biasing on the data, because we are

rounding up more than half of the time.

The confusion occurs because for 0-4 it looks like you are doing the same

operation; truncation. But for 0, you are actually just recasting the

value at a lower precision.

There's my $.02 worth,

Wendy

--

http://www.piclist.com hint: PICList Posts must start with ONE topic:

[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

See also: www.piclist.com/techref/index.htm?key=brain+burp+rounding