(Numeric) should -7 % 5 = -2 ?

Louis M. Pecora pecora at anvil.nrl.navy.mil
Wed Jul 2 14:59:05 EDT 2003


In article <mailman.1057088943.30504.python-list at python.org>, Bob
Gailer <bgailer at alum.rpi.edu> wrote:

> "When an integer a is divided by another m, one has
>          a = km + r
> where the remainder is some positive integer less than m.

Maybe I'm misunderstanding this, but what about -7 divided by 5?  We
get k=-1 and r=-2.  

m can be negative.  Maybe your quote was for the positive integers only.

-- 
Lou Pecora
  - My views are my own.




More information about the Python-list mailing list