[Haskell-cafe] Re: Simple quirk in behavior of `mod`
noel.kalman at googlemail.com
Wed Jul 22 10:23:53 EDT 2009
Thomas ten Cate schrieb:
> There are two ways of looking at the mod operator (on integers):
> 1. As a map from the integers Z to Z/pZ.
> 2. As the remainder under division by p.
> Since n mod 0 would be the remainder under division by 0, this
> correctly gives a division by zero error.
> I used to think that the definitions were equivalent... apparently not.
They are if you don't disallow division by zero with remainder. Namely, the
definition of “division with remainder” works as in (1).
More information about the Haskell-Cafe