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.

Author wohlganger
Recipients docs@python, mark.dickinson, terry.reedy, wohlganger
Date 2017-07-25.13:47:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1500990474.68.0.537392208618.issue31021@psf.upfronthosting.co.za>
In-reply-to
Content
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."
History
Date User Action Args
2017-07-25 13:47:54wohlgangersetrecipients: + wohlganger, terry.reedy, mark.dickinson, docs@python
2017-07-25 13:47:54wohlgangersetmessageid: <1500990474.68.0.537392208618.issue31021@psf.upfronthosting.co.za>
2017-07-25 13:47:54wohlgangerlinkissue31021 messages
2017-07-25 13:47:54wohlgangercreate