xxxxxxxxxx
The mod function produces a result that is either zero or has the same sign as the divisor. The rem function produces a result that is either zero or has the same sign as the dividend. Another difference is the convention when the divisor is zero.