The two concepts of modulus operation and take-rest operation are overlapping but not identical. The main difference is that there are different operations when dividing a negative integer into a division operation.
For the number of shapes and a, the method of modulo operation or redundancy operation is:
1, to seek the integer quotient c = A/b;
2, the calculation modulus or the remainder R = a-c* B.
The modulo and take-up operations differ in the first step:
The take-rest operation rounds in the 0 direction when the C value is taken, and the modulo operation is rounded to the negative infinity direction when the C value is taken.
In each environment, the meaning of the operator% is different, C/c++,java is the remainder, and Python is the modulo
The Java rule for taking the remainder is as follows:
A%b = A-(A/b) *b
Java redundancy operation "%"