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 eryksun
Recipients eryksun, marcosthomazs, martin.panter
Date 2017-03-15.10:39:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1489574388.86.0.574609366091.issue29815@psf.upfronthosting.co.za>
In-reply-to
Content
> -7 divided by 2 is -3, not -4

Integer division in Python is floor division, and it's self-consistent with the implementation of the modulo operation such that the following identity is satisfied: (a % n) == a - n * (a // n). For example: 

    (-7 % 2) == -7 - 2 * (-7 // 2)
           1 == -7 - 2 * (-4)
             == -7 + 8

This behavior is consistent with mathematical analysis languages such as MATLAB, Mathematica, Mathcad, and R. It's also consistent with Ruby, Perl, and Tcl. However, it's different from C, C++, C#, Java, PHP and many other languages. See the following Wikipedia article:

https://en.wikipedia.org/wiki/Modulo_operation

Please do not change the status and resolution of this issue again. This is not a bug.
History
Date User Action Args
2017-03-15 10:39:48eryksunsetrecipients: + eryksun, martin.panter, marcosthomazs
2017-03-15 10:39:48eryksunsetmessageid: <1489574388.86.0.574609366091.issue29815@psf.upfronthosting.co.za>
2017-03-15 10:39:48eryksunlinkissue29815 messages
2017-03-15 10:39:48eryksuncreate