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 david.fe...@gmail.com 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

Arithmetic overflow in rem and mod

2015-06-01 Thread Nikita Karetnikov
and div result in an arithmetic overflow: Prelude (minBound :: Int) `quot` (-1) *** Exception: arithmetic overflow Prelude (minBound :: Int) `div` (-1) *** Exception: arithmetic overflow while rem and mod don't: Prelude (minBound :: Int) `rem` (-1) 0 Prelude (minBound :: Int) `mod` (-1) 0

Re: Arithmetic overflow in rem and mod

2015-06-01 Thread David Feuer
-Real.html Note, however, that there is a case when quot and div result in an arithmetic overflow: Prelude (minBound :: Int) `quot` (-1) *** Exception: arithmetic overflow Prelude (minBound :: Int) `div` (-1) *** Exception: arithmetic overflow while rem and mod don't: Prelude (minBound :: Int