Skip to content

Commit 21e230a

Browse files
author
Gilles Sadowski
committed
MATH-1630: Runtime switch between JDK and CM implementations of the methods defined in "java.lang.Math".
Default is to use the CM implementations in order to retain previous behaviour. When using the JDK implementations, some unit tests fail (on Java 8). Class "AccurateMath" was moved to "o.a.c.math4.core" package. [Unit tests for that class were not moved because they depend on "legacy" classes.]
1 parent 39c4767 commit 21e230a

328 files changed

Lines changed: 3519 additions & 2393 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

commons-math-legacy-core/src/main/java/org/apache/commons/math4/legacy/core/jdkmath/AccurateMath.java renamed to commons-math-core/src/main/java/org/apache/commons/math4/core/jdkmath/AccurateMath.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package org.apache.commons.math4.legacy.core.jdkmath;
17+
package org.apache.commons.math4.core.jdkmath;
1818

1919
import java.io.PrintStream;
2020

commons-math-legacy-core/src/main/java/org/apache/commons/math4/legacy/core/jdkmath/AccurateMathCalc.java renamed to commons-math-core/src/main/java/org/apache/commons/math4/core/jdkmath/AccurateMathCalc.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package org.apache.commons.math4.legacy.core.jdkmath;
17+
package org.apache.commons.math4.core.jdkmath;
1818

1919
import java.io.PrintStream;
2020

21-
import org.apache.commons.math4.legacy.exception.DimensionMismatchException;
2221

2322
/** Class used to compute the classical functions tables.
2423
* @since 3.0
@@ -647,12 +646,11 @@ static String format(double d) {
647646
* Check two lengths are equal.
648647
* @param expectedLen expected length
649648
* @param actual actual length
650-
* @exception DimensionMismatchException if the two lengths are not equal
649+
* @throws IllegalStateException if the two lengths are not equal
651650
*/
652-
private static void checkLen(int expectedLen, int actual)
653-
throws DimensionMismatchException {
651+
private static void checkLen(int expectedLen, int actual) {
654652
if (expectedLen != actual) {
655-
throw new DimensionMismatchException(actual, expectedLen);
653+
throw new IllegalStateException(actual + " != " + expectedLen);
656654
}
657655
}
658656
}

commons-math-legacy-core/src/main/java/org/apache/commons/math4/legacy/core/jdkmath/AccurateMathLiteralArrays.java renamed to commons-math-core/src/main/java/org/apache/commons/math4/core/jdkmath/AccurateMathLiteralArrays.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
package org.apache.commons.math4.legacy.core.jdkmath;
18+
package org.apache.commons.math4.core.jdkmath;
1919

2020
/**
2121
* Utility class for loading tabulated data used by {@link AccurateMath}.

0 commit comments

Comments
 (0)