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

Jeff Wheeler jeff at nokrev.com
Thu Jul 23 01:09:07 EDT 2009


On Wed, Jul 22, 2009 at 1:34 PM, <gladstein at gladstein.com> wrote:

> Is the utility of having (n `mod` 0) return a value greater than the
> confusion it will engender? In the 99.99% case it's an error. You wouldn't
> want (n `div` 0) to return 0, I expect.

> If we want these number-theoretic mod and div operations let's please put
> them in a separate module.

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.

Jeff Wheeler


More information about the Haskell-Cafe mailing list