余数Remainders

ANSI 3.3.5 整除的余数的符号ANSI 3.3.5 The sign of the remainder on integer division

余数的符号与被除数的符号相同。The sign of the remainder is the same as the sign of the dividend. 例如,For example,

 50 / -6 == -8  
 50 % -6 ==  2  
-50 /  6 == -8  
-50 %  6 == -2  

另请参阅See Also

整数Integers