[MATH-1050] Remove deprecated methods ArithmeticUtils#pow(..., long).
This commit is contained in:
parent
5f47ad718e
commit
745d383af1
|
@ -54,6 +54,9 @@ If the output is not quite correct, check for invisible trailing spaces!
|
|||
</release>
|
||||
|
||||
<release version="4.0" date="XXXX-XX-XX" description="">
|
||||
<action dev="tn" type="remove" issue="MATH-1050">
|
||||
Removed "ArithmeticUtils#pow(int, long)" and "ArithmeticUtils#pow(long, long)".
|
||||
</action>
|
||||
<action dev="tn" type="update" issue="MATH-825" due-to="Gilles Sadowski">
|
||||
Method "LaguerreSolver#laguerre(...)" has been made private.
|
||||
</action>
|
||||
|
|
|
@ -678,34 +678,6 @@ public final class ArithmeticUtils {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Raise an int to a long power.
|
||||
*
|
||||
* @param k Number to raise.
|
||||
* @param e Exponent (must be positive or zero).
|
||||
* @return k<sup>e</sup>
|
||||
* @throws NotPositiveException if {@code e < 0}.
|
||||
* @deprecated As of 3.3. Please use {@link #pow(int,int)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static int pow(final int k, long e) throws NotPositiveException {
|
||||
if (e < 0) {
|
||||
throw new NotPositiveException(LocalizedFormats.EXPONENT, e);
|
||||
}
|
||||
|
||||
int result = 1;
|
||||
int k2p = k;
|
||||
while (e != 0) {
|
||||
if ((e & 0x1) != 0) {
|
||||
result *= k2p;
|
||||
}
|
||||
k2p *= k2p;
|
||||
e >>= 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Raise a long to an int power.
|
||||
*
|
||||
|
@ -752,34 +724,6 @@ public final class ArithmeticUtils {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Raise a long to a long power.
|
||||
*
|
||||
* @param k Number to raise.
|
||||
* @param e Exponent (must be positive or zero).
|
||||
* @return k<sup>e</sup>
|
||||
* @throws NotPositiveException if {@code e < 0}.
|
||||
* @deprecated As of 3.3. Please use {@link #pow(long,int)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static long pow(final long k, long e) throws NotPositiveException {
|
||||
if (e < 0) {
|
||||
throw new NotPositiveException(LocalizedFormats.EXPONENT, e);
|
||||
}
|
||||
|
||||
long result = 1l;
|
||||
long k2p = k;
|
||||
while (e != 0) {
|
||||
if ((e & 0x1) != 0) {
|
||||
result *= k2p;
|
||||
}
|
||||
k2p *= k2p;
|
||||
e >>= 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Raise a BigInteger to an int power.
|
||||
*
|
||||
|
|
|
@ -413,15 +413,6 @@ public class ArithmeticUtilsTest {
|
|||
// expected behavior
|
||||
}
|
||||
|
||||
Assert.assertEquals(1801088541l, ArithmeticUtils.pow(21l, 7l));
|
||||
Assert.assertEquals(1l, ArithmeticUtils.pow(21l, 0l));
|
||||
try {
|
||||
ArithmeticUtils.pow(21l, -7l);
|
||||
Assert.fail("Expecting MathIllegalArgumentException");
|
||||
} catch (MathIllegalArgumentException e) {
|
||||
// expected behavior
|
||||
}
|
||||
|
||||
BigInteger twentyOne = BigInteger.valueOf(21l);
|
||||
Assert.assertEquals(BigInteger.valueOf(1801088541l), ArithmeticUtils.pow(twentyOne, 7));
|
||||
Assert.assertEquals(BigInteger.ONE, ArithmeticUtils.pow(twentyOne, 0));
|
||||
|
|
Loading…
Reference in New Issue