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

Max Rabkin max.rabkin at gmail.com
Thu Jul 23 05:09:37 EDT 2009


2009/7/23 Matthias Görgens <matthias.goergens at googlemail.com>:
>> Couldn't the same be said for round-to-even, instead of rounding down
>> like every other language? I doubt any beginners have ever expected
>> it, but it's probably better.
>
> What do you mean with round-to-even?  For rounding down there's floor.

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.

The most common alternative is round-half-up.

--Max


More information about the Haskell-Cafe mailing list