[Nickle] Modulus is broken

Barton C Massey bart at cs.pdx.edu
Sun Dec 9 00:54:21 PST 2007


  > q = 7 // -3
  -3
  > r = 7 % -3
  1
  > q * -3 + r
  10

The manual page promises that the last number will be 7.
Given the definition of //, this is what Warren in "Hacker's
Delight" refers to as "floor division", except that we have
the modulus wrong---it should be -2 in this example.

I'll figure out and submit a patch if it's a bug---I think
it is.

    Bart


More information about the Nickle mailing list