Difference between `mod` and `rem` in Haskell

They’re not the same when the second argument is negative:

2 `mod` (-3)  ==  -1
2 `rem` (-3)  ==  2

Leave a Comment