Skip to content

div and mod return wrong result

According to the Haskell 98 report, div is supposed to round down to negative infinity. Thus, -10 div 3 should be -4, but when I enter this into ghci, I get -3 instead. Likewise, -10 mod 3 should be 2, but ghci evaluates this expression to -1.

I'm running Mac OS X 10.4.

Trac metadata
Trac field Value
Version 6.4.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information