home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pipex!bnr.co.uk!uknet!acorn!armltd!dseal
- From: dseal@armltd.co.uk (David Seal)
- Newsgroups: sci.math
- Subject: Re: Rounding Rules
- Message-ID: <11005@armltd.uucp>
- Date: 22 Dec 92 12:43:12 GMT
- References: <LOTTO.92Dec21062820@math.math.berkeley.edu>
- Sender: dseal@armltd.uucp
- Distribution: sci
- Organization: A.R.M. Ltd, Swaffham Bulbeck, Cambs, UK
- Lines: 101
-
- In article <LOTTO.92Dec21062820@math.math.berkeley.edu>
- lotto@math.berkeley.edu (Ben Lotto) writes:
-
- >>>>>> On Sun, 20 Dec 1992 00:30:18 GMT, shaw@toadflax.UCDavis.EDU (Rob Shaw) said:
- >
- >Rob> What is the rationale behind the following rounding rule?
- >
- >Rob> when dealing with 5's followed by all zero's, check the
- >Rob> next digit to the left. If it's even, round down; odd,
- >Rob> round up.
- >
- >I was told way back in my undergraduate days that one should generally
- >"round to evens." Someone recently explained the rationale for this
- >as follows. Suppose we start with 1.49 and round in the traditional
- >manner twice. First we would round to 1.5 and then to 2. On the
- >other hand, if we round just once we get 1. Rounding to evens
- >prevents us from getting different answers.
-
- Sorry, this isn't true. In particular, if you actually apply the above rule
- to 1.5, you get 2. If instead it were "if even, round up; if odd, round
- down", then 1.51 would round to 1.5 and then to 1 in two roundings, but to 2
- in one rounding.
-
- It is in fact impossible to produce a tie-breaking technique for the "round
- to nearest" rule which makes one rounding and two roundings always produce
- the same answer, at least if the base of your number system is even. Reason:
- let the base be B, and let the digit A be B/2. Consider the two numbers 1.A
- - 0.001 and 1.A + 0.001. Doing one single rounding to an integer, they round
- to 1 and 2 respectively, since they are just below and just above the "tie"
- case. Rounding to one place, they both round to 1.A: however we do a
- subsequent second rounding to an integer, they're going to come out the
- same. So one rounding will produce different results for the two numbers and
- two roundings will produce the same results for the two numbers: it is
- therefore impossible for the one rounding result and the two roundings
- result to always be the same as each other.
-
- The real reason for this rounding rule is that it is unbiased: i.e. the
- expected change in the value of a number on rounding it is zero. This is not
- true of the ordinary "round up in the tie case" rule: e.g. rounding from 1
- decimal place to an integer, we have 10 equiprobable cases:
-
- x.0 rounds to x: change in value = 0.0;
- x.1 rounds to x: change in value = -0.1;
- x.2 rounds to x: change in value = -0.2;
- x.3 rounds to x: change in value = -0.3;
- x.4 rounds to x: change in value = -0.4;
- x.5 rounds to x+1: change in value = 0.5;
- x.6 rounds to x+1: change in value = 0.4;
- x.7 rounds to x+1: change in value = 0.3;
- x.8 rounds to x+1: change in value = 0.2;
- x.9 rounds to x+1: change in value = 0.1;
- ------------------------------------------
- Total change in value = 0.5;
- Average change per rounding = 0.5/10 = 0.05.
-
- With the even-odd rule, there are 20 equiprobable cases:
-
- e.0 rounds to e: change in value = 0.0;
- e.1 rounds to e: change in value = -0.1;
- e.2 rounds to e: change in value = -0.2;
- e.3 rounds to e: change in value = -0.3;
- e.4 rounds to e: change in value = -0.4;
- e.5 rounds to e: change in value = -0.5;
- e.6 rounds to e+1: change in value = 0.4;
- e.7 rounds to e+1: change in value = 0.3;
- e.8 rounds to e+1: change in value = 0.2;
- e.9 rounds to e+1: change in value = 0.1;
- o.0 rounds to o: change in value = 0.0;
- o.1 rounds to o: change in value = -0.1;
- o.2 rounds to o: change in value = -0.2;
- o.3 rounds to o: change in value = -0.3;
- o.4 rounds to o: change in value = -0.4;
- o.5 rounds to o+1 change in value = 0.5;
- o.6 rounds to o+1: change in value = 0.4;
- o.7 rounds to o+1: change in value = 0.3;
- o.8 rounds to o+1: change in value = 0.2;
- o.9 rounds to o+1: change in value = 0.1;
- ------------------------------------------
- Total change in value = 0.0;
- Average change per rounding = 0.0/20 = 0.00.
-
- This can be important e.g. when many values are added together. For an
- unbiased rounding rule, the total rounding error will be of the order of
- SQR(N) * standard deviation of change in value, where N is the number of
- values summed. For a biased rounding rule, this is increased by N*bias.
- Because of the difference in growth rate between the multipliers of SQR(N)
- and N, even a small bias can become the dominant source of errors for large
- values of N.
-
- One other point to note: in arithmetic done by hand, the bias is +0.05 for
- positive values and -0.05 for negative values: this is essentially because
- we use a sign/magnitude representation for numbers. This *may* come out
- fairly unbiased if the numbers are reasonably symmetrically placed around
- zero. The same is *not* true of the standard two's complement representation
- on computers, for which the "round up in tie case" rule will have a positive
- bias regardless of the sign of the numbers.
-
- David Seal
- dseal@armltd.co.uk
-
- All opinions are mine only...
-