1

私は powermod 関数に取り組んでいて、いくつかの奇妙な結果を得ています。おそらく誰かが私が見ているものを説明するのを助けることができます...

int a = 2147483647
int b = Integer.MAX_VALUE
int m = 3
long _A = (long) a;
BigInteger A = BigInteger.valueOf(a);
BigInteger M = BigInteger.valueOf(m);
// Compute with BigInteger  
int x = A.multiply(A).mod(M).intValue();
//compute with long
int y = (int) ((_A*_A) %m);
assert x ==y ; // is false?
4

0 に答える 0