[issue22337] Modulus not returning proper remainder

2014-09-04 Thread R. David Murray
R. David Murray added the comment: This is, indeed, the way Python works. See https://docs.python.org/3/reference/expressions.html where you will 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

[issue22337] Modulus not returning proper remainder

2014-09-04 Thread DenisCrnic
New submission from DenisCrnic: Modulus is returning wrong remainder when working with negative numbers. For example 34%-3 should return 1, but it returns -2. 34/-3=-11, remainder: 1, proof: -11*(-3)+1=34 <--- Math logic (works in Java for example) but python goes like that: 34/-3=12, remainde