This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: % gives wrong results
Type: Stage:
Components: Interpreter Core Versions: Python 2.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: mwh, nathanoj
Priority: normal Keywords:

Created on 2005-05-08 19:35 by nathanoj, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg25250 - (view) Author: Jonathan (nathanoj) Date: 2005-05-08 19:35
when playing with % i got 5 % -3 = -1 
This occured on the windows python 2.3 build,
and a python 2.4.1 build on a linux pc (with gcc 3.3.5)
msg25251 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2005-05-08 20:08
Logged In: YES 
user_id=6656

Why do you think this is a bug?  On http://docs.python.org/ref/binary.html 
we find:

The modulo operator always yields a result with the same sign as its 
second operand (or zero); the absolute value of the result is strictly smaller 
than the absolute value of the second operand.

Closing.
History
Date User Action Args
2022-04-11 14:56:11adminsetgithub: 41963
2005-05-08 19:35:27nathanojcreate