[GHC] #643: div and mod return wrong result

GHC trac at galois.com
Sun Jan 1 15:34:34 EST 2006


#643: div and mod return wrong result
--------------------------+-------------------------------------------------
    Reporter:  anonymous  |        Owner:         
        Type:  bug        |       Status:  new    
    Priority:  normal     |    Milestone:         
   Component:  GHCi       |      Version:  6.4.1  
    Severity:  normal     |     Keywords:         
          Os:  MacOS X    |   Difficulty:  Unknown
Architecture:  powerpc    |  
--------------------------+-------------------------------------------------
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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/643>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list