Class RealFrac: round
Jerzy Karczmarczuk
karczma@info.unicaen.fr
Wed, 09 May 2001 17:07:21 +0200
Lennart Augustsson comment to :
> Rijk-Jan van Haaften wrote:
...
> > The strange case is if signum (abs r - 0.5) is 0:
> > such numbers are round to the nearest EVEN integer. In mathematics,
> > computer science (the studies I'm doing) and physics, as far as I
> > know, it is usual to round such numbers up, rather than to the nearest
> > integer. For example:
> ...
> Rounding to the nearest even number is considered the best practice by
> people doing numerical analysis. Even when I went to school (25 - 30
> years ago) we were taught to round to the nearest even number, so it's
> not exactly new.
>
> -- Lennart
I wonder whether it has anything to do with the "best practice". I suppose
that this is the natural way to get rid of one more bit of mantissa.
Anyway, there is the standard IEEE 754 (with its 4 rounding modes...) and
it is good to have a published standard, even if it results in some hangover
of some people. The reported behaviour is also visible in Clean, and I spent
2 days on debugging because of that "round-ties-to-even rule"... It is not
very "natural" psychologically, and from time to time I do some mistakes,
although I know the stuff.
Look here: (among 100 other references I could give you)
http://www.validgh.com/goldberg/addendum.html
http://developer.intel.com/technology/itj/q41999/articles/art_6.htm
http://www.cs.umass.edu/~weems/CmpSci535/535lecture6.html
Jerzy Karczmarczuk
Caen, France