Code review request for 6560935: BigInteger.modPow() throws ArithmeticException for negative exponent (original) (raw)

Joseph D. Darcy Joe.Darcy at Sun.COM
Tue Oct 20 21:45:13 UTC 2009


Hello.

Please review this small doc clarification; modPow is not defined for negative exponents unless the BigInteger being operated on is relatively prime to the modulus. There are a few stylistic javadoc cleanups in the patch below too.

Webrev: http://cr.openjdk.java.net/~darcy/6560935.0/

Thanks,

-Joe

--- old/src/share/classes/java/math/BigInteger.java 2009-10-20 14:40:35.000000000 -0700 +++ new/src/share/classes/java/math/BigInteger.java 2009-10-20 14:40:35.000000000 -0700 @@ -478,7 +478,7 @@

 /**
  * Constructs a randomly generated BigInteger, uniformly 

distributed over

random * bits is provided in {@code rnd}. Note that this constructor always * constructs a non-negative BigInteger. @@ -1332,7 +1332,7 @@ * * @param val value by which this BigInteger is to be divided. * @return {@code this / val}

@@ -1352,7 +1352,7 @@ * @return an array of two BigIntegers: the quotient {@code (this / val)} * is the initial element, and the remainder {@code (this % val)} * is the final element.

@@ -1371,7 +1371,7 @@ * @param val value by which this BigInteger is to be divided, and the * remainder computed. * @return {@code this % val}

@@ -1547,7 +1547,7 @@ * * @param m the modulus. * @return {@code this mod m}

BigInteger * is not relatively prime to m). / @@ -2449,7 +2451,7 @@ /* * Returns {@code true} if this BigInteger is probably prime, * {@code false} if it's definitely composite. If



More information about the core-libs-dev mailing list