[Haskell-cafe] Re: Simple quirk in behavior of `mod`

Henning Thielemann lemming at henning-thielemann.de
Mon Aug 3 16:25:35 EDT 2009


Matthias Görgens schrieb:
>> Round-to-even means x.5 gets rounded to x if x is even and x+1 if x is
>> odd. This is sometimes known as banker's rounding.
> 
> OK.  That's slightly unusual indeed.

Modula-3 makes it too.

Accidentally, I recently had a case where this rounding mode was really
bad. I wanted to reduce pictures by arbitrary factors and for the sake
of speed it was enough to just move the pixels from the source to their
target position and don't do any interpolation. However for factor 2
reduction I got ugly patterns, because pixels accumulated around even
target coordinates.




More information about the Haskell-Cafe mailing list