# Re: Re: Rounding??

• From: Guenter Milde <G Milde physik tu-dresden de>
• To: gnumeric-list gnome org
• Cc: G Milde physik tu-dresden de
• Subject: Re: Re: Rounding??
• Date: Mon, 18 Jun 2001 16:32:43 +0200 (CEST)

```On Fri, 15 Jun 2001 09:59:41 -0600 wrote Andreas J. Guelzow <aguelzow math concordia ab ca>:

```
```If you have a large sample of random numbers the relative frequency of the
digits 0 - 9 will be the same. The rounding error for a number with r digits is
|a - z| <= 0.5e-r, for r = 1 we have

digit round_up even_rule
0            0               0
1         -1          -1
2        -2         -2
3        -3         -3
4        -4         -4
5         5       -5 or 5 (with half/half probability)
6         4          4
7         3          3
8         2          2
9         1          1

If we round "the accountants way", the expectation (mean) value of the
rounding error is 0.5, if we round_to_even, the expectation value of the
rounding error is 0.
```
```
That's correct if we only consider a finite population. We really have a
continuum of numbers in that interval that are uniformly distributed. In
that case, which way the single value 0.5000000... is rounded has in
fact no influence on the integral calculating the expected value.
```
```
On Sat, 16 Jun 2001 09:12:31 +1000 wrote Phillip J Shelton <shelton11 dingoblue net au>:

```
```...  By rounding, we are making holes in
the continuum.
```
```
So it is not a problem of finite or infinite population, but of discrete vs.
continually distributed values. For truly continually dirstributed values,
the occurence of the single value 0.50000... is "eine Menge vom Maß 0" (a
set of measure zero), i.e. there is no rounding error also with the simple
"0.5 rounds up" rule. However, having a floating_point representation,
computers always count with discrete values. Yet even in this case, the
rounding error is relatively small, if the number of significant digits is
considerabely smaller than the floating-point precision.

To be concise, the rounding error depends on the number of digits we will
truncate, the abovementioned error of 0.5 is only valid, if we shorten the
representation by one digit, i.e. "round natural numbers to full decades".
The error becomes 0.05 if we take off two digits (like "give your hight in
full meters (when you normally know it to the precision of centimeters) and
generally it is 5*10^{-n} with 'n' the number of digits we throw by rounding.

As in most cases this number is more than 1, the much simpler "5 rounds up"
rule is sufficient in most cases.

And the quite complicated "round to even"is no longer tought in German
school nowadays (Still it is to be found in e.g. Bronstein-Semendjajew:
"Taschenbuch der Mathematik").

To conclude: Having a "rounding behaviour" tab would be nice, but in most
cases the current "5 rounds up" mechanism is ok - if only the people
remembered, that rounding always means approximation.

Guenter Milde

--
G Milde physik tu-dresden de

```