aboutsummaryrefslogtreecommitdiff
path: root/src/share/classes/java/math
diff options
context:
space:
mode:
authordarcy <none@none>2009-10-21 09:53:23 -0700
committerdarcy <none@none>2009-10-21 09:53:23 -0700
commit5ceda284a431f72eac0dc80842dad0b6d3bf33cb (patch)
tree5eb1dfef9ad8b08ba59850ca7d0a85bb79c0c2ca /src/share/classes/java/math
parentc90680d82fdbf724f46b1b36ba5f5b987950eae0 (diff)
downloadjdk8u_jdk-5ceda284a431f72eac0dc80842dad0b6d3bf33cb.tar.gz
6560935: BigInteger.modPow() throws ArithmeticException for negative exponent
Reviewed-by: alanb
Diffstat (limited to 'src/share/classes/java/math')
-rw-r--r--src/share/classes/java/math/BigInteger.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/share/classes/java/math/BigInteger.java b/src/share/classes/java/math/BigInteger.java
index c730112464..a00c6633fc 100644
--- a/src/share/classes/java/math/BigInteger.java
+++ b/src/share/classes/java/math/BigInteger.java
@@ -478,7 +478,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
/**
* Constructs a randomly generated BigInteger, uniformly distributed over
- * the range {@code 0} to (2<sup>{@code numBits}</sup> - 1), inclusive.
+ * the range 0 to (2<sup>{@code numBits}</sup> - 1), inclusive.
* The uniformity of the distribution assumes that a fair source of random
* bits is provided in {@code rnd}. Note that this constructor always
* constructs a non-negative BigInteger.
@@ -1332,7 +1332,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
*
* @param val value by which this BigInteger is to be divided.
* @return {@code this / val}
- * @throws ArithmeticException {@code val==0}
+ * @throws ArithmeticException if {@code val} is zero.
*/
public BigInteger divide(BigInteger val) {
MutableBigInteger q = new MutableBigInteger(),
@@ -1352,7 +1352,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* @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.
- * @throws ArithmeticException {@code val==0}
+ * @throws ArithmeticException if {@code val} is zero.
*/
public BigInteger[] divideAndRemainder(BigInteger val) {
BigInteger[] result = new BigInteger[2];
@@ -1371,7 +1371,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* @param val value by which this BigInteger is to be divided, and the
* remainder computed.
* @return {@code this % val}
- * @throws ArithmeticException {@code val==0}
+ * @throws ArithmeticException if {@code val} is zero.
*/
public BigInteger remainder(BigInteger val) {
MutableBigInteger q = new MutableBigInteger(),
@@ -1547,7 +1547,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
*
* @param m the modulus.
* @return {@code this mod m}
- * @throws ArithmeticException {@code m <= 0}
+ * @throws ArithmeticException {@code m} &le; 0
* @see #remainder
*/
public BigInteger mod(BigInteger m) {
@@ -1566,7 +1566,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* @param exponent the exponent.
* @param m the modulus.
* @return <tt>this<sup>exponent</sup> mod m</tt>
- * @throws ArithmeticException {@code m <= 0}
+ * @throws ArithmeticException {@code m} &le; 0 or the exponent is
+ * negative and this BigInteger is not <i>relatively
+ * prime</i> to {@code m}.
* @see #modInverse
*/
public BigInteger modPow(BigInteger exponent, BigInteger m) {
@@ -2015,7 +2017,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
*
* @param m the modulus.
* @return {@code this}<sup>-1</sup> {@code mod m}.
- * @throws ArithmeticException {@code m <= 0}, or this BigInteger
+ * @throws ArithmeticException {@code m} &le; 0, or this BigInteger
* has no multiplicative inverse mod m (that is, this BigInteger
* is not <i>relatively prime</i> to m).
*/
@@ -2449,7 +2451,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
/**
* Returns {@code true} if this BigInteger is probably prime,
* {@code false} if it's definitely composite. If
- * {@code certainty} is {@code <= 0}, {@code true} is
+ * {@code certainty} is &le; 0, {@code true} is
* returned.
*
* @param certainty a measure of the uncertainty that the caller is