[PerlChina] 问个问题,关于余数的...

qiulj maiko qiulj.maiko at gmail.com
Tue Dec 20 01:27:46 PST 2005


print 3 % -2;和print 7 % -5;内部是一样的
最后一个你是怎么理解的?



在 05-12-20,YW<ywomol at gmail.com> 写道:
> 问个问题:
> C:\Documents and Settings\YW>perl
> print -3 % 2;
> ^Z
> 1
> C:\Documents and Settings\YW>perl
> print -5 % 7;
> ^Z
> 2
> C:\Documents and Settings\YW>perl
> print 7 % -5;
> ^Z
> -3
> C:\Documents and Settings\YW>perl
> print 3 % -2;
> ^Z
> -1
> ----------
> 倒数第二个, 7% -5, 太古怪了, 内部不知道是怎么算的?
>


More information about the China-pm mailing list