The difference between the remainder in C and the modulus of taking
Have not noticed this problem before, check a bit today, feel too cumbersome, now simple and clear summary
For integer number A,b, the method of modulo operation or remainder operation is:
1. Find the integer quotient: c = A/b;
2. Computational model or remainder: R = a-c*b.
The modulus operation and the remainder operation are different in the first step: the remainder operation is rounded in the 0 direction when the value of C is taken, while the modulo operation rounds in the negative infinity direction when calculating the value of C.
The so-called round to the 0 direction, that is, the decimal point as the boundary, the decimal part directly removed. such as (INT) -1.324=-1 (also called truncation method);
Rounding in the negative infinity direction means that the end result is smaller than the real value. such as (int) -1.324=-2; (int here is cast data type)
Note that C refers to the business;