Charles Wohlganger added the comment:

Modulo is defined mathematically as the remainder of Euclidian division. I.E. a 
positive r where a % b = r is equivalent to a = b * x + r. I think it confuses 
the issue to say "-190 % 12 were the mathematical equivalent -10", when that is 
technically incorrect.

Computer modulo uses truncated division, which is why -a % b != a % -b.

"... compilers that truncate i // j need to make i % j have the same sign as i."
i % j has the same sign as j, not i. I believe that is the typo that has caused 
the confusion.

I would replace the last line with :
"-190 % 12 == -10 is wrong according to the C definition for computer modulo 
arithmetic."

----------
nosy: +wohlganger

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue31021>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to