-1796254192 `div` 357566600 == 5 ??
Alastair Reid
reid at reid-consulting-uk.ltd.uk
Thu Jun 27 19:08:51 EDT 2002
>> Prelude> -1796254192 `div` 357566600
>> -5
> Except that the answer should be -6. This is bizarre. What do you
> get for this one?
>> Prelude> -1796254192 `divMod` 357566600
> (5,349145408)
Can you add some parentheses to these expressions so we're sure what
we're looking at. Using Hugs I get:
Prelude> (-1796254192 `divMod` 357566600) :: (Integer,Integer)
ERROR - Unresolved overloading
*** Type : Num (Integer,Integer) => (Integer,Integer)
*** Expression : negate (divMod 1796254192 357566600)
Prelude> (-1796254192) `divMod` 357566600
(-6,349145408)
Prelude> (-1796254192) `div` 357566600
-6
Prelude> -1796254192 `div` 357566600
-5
(I'm not claiming that Hugs is right and GHC/GHCi wrong - they might
both be wrong for all I know.)
--
Alastair
More information about the Glasgow-haskell-bugs
mailing list