[Numpy-discussion] sign of modulo

Eric Nodwell nodwell at physics.ubc.ca
Fri Oct 12 10:40:13 EDT 2001

The Numpy version of modulo uses a different sign convention for
negative arguments than does Python itself:

>>> -5 % 3
>>> array((-5,-5)) % 3
array([-2, -2])

(Numpy version 20.2.0, Python version 1.5.2 and version 2.2a4.)

Is there a reason for this (hard to imagine), or is this a bug?


More information about the NumPy-Discussion mailing list