Let's say that
x / y = z,
x, y, z being integers.
There is no guarantee that
z * y = x, because the "/" operator rounds down.
So, we have to add the remainder to our equation:
z * y = x + r.
z * y = x + r
z * (-y) = - (z * y) = -(x + r) = -x - r
This means that the result of the operator "%" can be negative, which means that the operator "%" or the remainder is different from the absolute value of the relation, because the result is not guaranteed to be canonical.
source
share