[Haskell-cafe] quotRem and divMod
Artyom Kazak
artyom.kazak at gmail.com
Tue Jan 29 13:26:02 CET 2013
Shachaf Ben-Kiki <shachaf at gmail.com> писал(а) в своём письме Tue, 29 Jan
2013 09:09:37 +0300:
> That code is from base 4.5. Here's base 4.6:
>
> quotRem x@(I32# x#) y@(I32# y#)
> | y == 0 = divZeroError
> -- Note [Order of tests]
> | y == (-1) && x == minBound = (overflowError, 0)
> | otherwise = case x# `quotRemInt#` y# of
> (# q, r #) ->
> (I32# (narrow32Int# q),
> I32# (narrow32Int# r))
>
> So it looks like it was improved in GHC 7.6. In particular, by this
> commit:
> http://www.haskell.org/pipermail/cvs-libraries/2012-February/014880.html
>
> Shacha
Well, I’m glad to know that it has been fixed in the newer GHC (I’m still
on 7.4). Thanks!
More information about the Haskell-Cafe
mailing list