At 17:22 +0000 1998/12/21, Keith Wansbrough wrote:
>This is generally considered the most accurate kind of rounding, since it
>avoids cumulative errors.  If you get lots of values on the 0.5 boundary,
>`round up' gives you an error of +0.5 for each, whereas round-to-even gives
>you a mean error of zero.

Well, it does not work if you have a lot of even, or a lot of odd numbers
on the boundary.

>I think IEEE floating point does this by default for its basic operations.

There might be an advantage when the number of bits cut off in the rounding
is small (assuming the numbers bits are statistically evenly distributed),
increasing the chance of ending up on the boundary. This is normally not
the case when rounding floats to integers.

I think that many will expect it to be rounded up. (A program rounding say
money exchange might inadvertently break the law.)

If you are unsure about this, you should supply both variations, so that
people can choose. Perhaps by adding an extra parameter (say Bool), for the
two cases.

  Hans Aberg
                  * Email: Hans Aberg <mailto:[EMAIL PROTECTED]>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>




Reply via email to