Re: Arithmetic overflow in rem and mod

2015-06-02 Thread Edward Kmett
We went round and round on this back in August. The ultimate decision was to leave the existing behavior for quot and div as sufficient consensus for changing it was not reached. I've updated the ticket in question to reflect that resolution. -Edward On Mon, Jun 1, 2015 at 6:40 PM, Nikita Karet

Re: Arithmetic overflow in rem and mod

2015-06-02 Thread Reid Barton
The current behavior is quite intentional. On Mon, Jun 1, 2015 at 1:23 PM, David Feuer wrote: > I think this is a mistake, yes. They should not raise such exceptions, but > rather just wrap around—minBound `quot` (-1) should be -minBound=minBound. > That would justify the behavior of rem and mod

Re: Arithmetic overflow in rem and mod

2015-06-01 Thread David Feuer
I think this is a mistake, yes. They should not raise such exceptions, but rather just wrap around—minBound `quot` (-1) should be -minBound=minBound. That would justify the behavior of rem and mod, and makes much more sense than the current behavior for Int as a ring. On Jun 1, 2015 12:41 PM, "Niki

Arithmetic overflow in rem and mod

2015-06-01 Thread Nikita Karetnikov
According to the documentation, rem and mod must satisfy the following laws: -- > (x `quot` y)*y + (x `rem` y) == x rem -- > (x `div` y)*y + (x `mod` y) == x mod https://hackage.haskell.org/package/base-4.8.0.0/docs/src/GHC-Real.html Note, however, that there is a case when quot