You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2015/02/17 00:14:08 UTC
[math] [MATH-1050] Remove deprecated methods ArithmeticUtils#pow(...,
long).
Repository: commons-math
Updated Branches:
refs/heads/master 5f47ad718 -> 745d383af
[MATH-1050] Remove deprecated methods ArithmeticUtils#pow(..., long).
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/745d383a
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/745d383a
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/745d383a
Branch: refs/heads/master
Commit: 745d383af12137ccbcbe1f3cb4c9db73f87a66ca
Parents: 5f47ad7
Author: Thomas Neidhart <th...@gmail.com>
Authored: Tue Feb 17 00:13:36 2015 +0100
Committer: Thomas Neidhart <th...@gmail.com>
Committed: Tue Feb 17 00:13:36 2015 +0100
----------------------------------------------------------------------
src/changes/changes.xml | 3 ++
.../commons/math4/util/ArithmeticUtils.java | 56 --------------------
.../commons/math4/util/ArithmeticUtilsTest.java | 9 ----
3 files changed, 3 insertions(+), 65 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-math/blob/745d383a/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index e727dfe..6f54583 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -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>
http://git-wip-us.apache.org/repos/asf/commons-math/blob/745d383a/src/main/java/org/apache/commons/math4/util/ArithmeticUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/ArithmeticUtils.java b/src/main/java/org/apache/commons/math4/util/ArithmeticUtils.java
index 027fa29..d6262a5 100644
--- a/src/main/java/org/apache/commons/math4/util/ArithmeticUtils.java
+++ b/src/main/java/org/apache/commons/math4/util/ArithmeticUtils.java
@@ -679,34 +679,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.
*
* @param k Number to raise.
@@ -753,34 +725,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.
*
* @param k Number to raise.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/745d383a/src/test/java/org/apache/commons/math4/util/ArithmeticUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/ArithmeticUtilsTest.java b/src/test/java/org/apache/commons/math4/util/ArithmeticUtilsTest.java
index 74c8564..525dbff 100644
--- a/src/test/java/org/apache/commons/math4/util/ArithmeticUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/util/ArithmeticUtilsTest.java
@@ -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));