-1796254192 `div` 357566600 == 5 ??

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Fri Jun 28 05:24:13 EDT 2002


Dylan Thurston <dpt at lotus.bostoncoop.net> writes:

> Thanks for pointing this out; this seems to be another bug in ghc
> 5.02.2.  According to the report, it seems unambiguous that, e.g.,
> -5`div`2 should be -2, not -3.

Yes,    -5`div`2  ==  -(5`div`2)  ==  -2
but   (-5)`div`2  ==  -3

Ghc 5.02.2 has the infix priority wrong, and interprets the former as the latter.
But more bizarrely, ghc 5.02.2 gets this very wrong:

    Prelude> (-1796254192) `div` 357566600
    5

Regards,
    Malcolm



More information about the Glasgow-haskell-bugs mailing list