(1)(A mod B)的符号与B的符号相同,并且
(2)abs(A mod B)以下为原文
The modulus operator which can be applied to integer types. The result of the expression "A mod B" is an integer type and is defined to be the value such that:
(1) the sign of (A mod B) is the same as the sign of B, and
(2) abs (A mod B) < abs (B), and
(3) (A mod B) = (A * (B - N)) for some integer N
example:
6 mod 4 : 2
6 mod -4 : -2
-6 mod 4 : 2
The remainder operator which can be applied to integer types. The result of the expression "A rem B" is an integer type and is defined to be the value such that:
(1) the sign of (A rem B) is the same as the sign of A, and
(2) abs (A rem B) < abs (B), and
(3) (A rem B) = (A - (A / B) * B).
Example:
6 mod 4 : 2
6 mod -4 : -2
-6 mod 4 : 2
---------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------