> After a looking a little more, there seem to be other problems > (including errors in my proposed solution). I don't know where the > code for quotRem is, but it is also buggy. For instance, > > Prelude> 9 `quotRem` (-5) > (-1,4) > > (The correct answer is (-1,-4).) I'm frankly astonished: has noone > used these functions with negative arguments before?
GHC's answer looks right to me, since according to the report: (x `quot` y)*y + (x `rem` y) == x so (-1 * -5) + 4 == 9 but if 9 `rem` (-5) should be -4, then (-1 * -5) + -4 = 1 > I'm shocked that non of the three Haskell implementations had a test > suite that caught this problem. Take a look at fptools/testsuite/tests/ghc-regress/numeric/should_run/arith0011.hs. There may be one or two wrong answers lurking in there, but that's a lot of results to check by hand! Cheers, Simon _______________________________________________ Glasgow-haskell-bugs mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs