You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2017/05/03 23:28:10 UTC
[1/4] [math] MATH-1416: Depend on "Commons Numbers".
Repository: commons-math
Updated Branches:
refs/heads/master cc26f76ad -> e082e0c48
MATH-1416: Depend on "Commons Numbers".
Added dependency on module "commons-numbers-core" (snapshot).
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/4680647f
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/4680647f
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/4680647f
Branch: refs/heads/master
Commit: 4680647f69bfb56da863c54272123dba0826ffab
Parents: cc26f76
Author: Gilles <er...@apache.org>
Authored: Thu May 4 01:06:12 2017 +0200
Committer: Gilles <er...@apache.org>
Committed: Thu May 4 01:06:12 2017 +0200
----------------------------------------------------------------------
pom.xml | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-math/blob/4680647f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 86242b5..8bec22c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -362,6 +362,12 @@
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
+ <artifactId>commons-numbers-core</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
<artifactId>commons-rng-client-api</artifactId>
<version>1.0</version>
</dependency>
[2/4] [math] Prevent build failure of the "javadoc" tool on Java 8.
Posted by er...@apache.org.
Prevent build failure of the "javadoc" tool on Java 8.
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/ef2507a8
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/ef2507a8
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/ef2507a8
Branch: refs/heads/master
Commit: ef2507a81658a658c5defdf68a1f1b8259d48aa4
Parents: 4680647
Author: Gilles <er...@apache.org>
Authored: Thu May 4 01:12:22 2017 +0200
Committer: Gilles <er...@apache.org>
Committed: Thu May 4 01:12:22 2017 +0200
----------------------------------------------------------------------
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-math/blob/ef2507a8/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8bec22c..64b2804 100644
--- a/pom.xml
+++ b/pom.xml
@@ -587,7 +587,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
- <additionalparam>-header '<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>'</additionalparam>
+ <additionalparam>--allow-script-in-comments -header '<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>'</additionalparam>
</configuration>
</plugin>
</plugins>
@@ -738,7 +738,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
- <additionalparam>-header '<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>'</additionalparam>
+ <additionalparam>--allow-script-in-comments -header '<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>'</additionalparam>
</configuration>
</plugin>
</plugins>
[3/4] [math] MATH-1416: Depend on "Commons Numbers".
Posted by er...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/distribution/LevyDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/LevyDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/LevyDistributionTest.java
index 659e418..0e25259 100644
--- a/src/test/java/org/apache/commons/math4/distribution/LevyDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/LevyDistributionTest.java
@@ -17,7 +17,7 @@
package org.apache.commons.math4.distribution;
import org.apache.commons.math4.distribution.LevyDistribution;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/distribution/LogisticsDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/LogisticsDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/LogisticsDistributionTest.java
index b43daac..b866dd9 100644
--- a/src/test/java/org/apache/commons/math4/distribution/LogisticsDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/LogisticsDistributionTest.java
@@ -17,7 +17,7 @@
package org.apache.commons.math4.distribution;
import org.apache.commons.math4.distribution.LogisticDistribution;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/distribution/NakagamiDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/NakagamiDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/NakagamiDistributionTest.java
index aa7e927..75628de 100644
--- a/src/test/java/org/apache/commons/math4/distribution/NakagamiDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/NakagamiDistributionTest.java
@@ -17,7 +17,7 @@
package org.apache.commons.math4.distribution;
import org.apache.commons.math4.distribution.NakagamiDistribution;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/distribution/UniformIntegerDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/UniformIntegerDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/UniformIntegerDistributionTest.java
index d1fc316..7d552dc 100644
--- a/src/test/java/org/apache/commons/math4/distribution/UniformIntegerDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/UniformIntegerDistributionTest.java
@@ -22,7 +22,7 @@ import org.junit.Test;
import org.apache.commons.math4.distribution.IntegerDistribution;
import org.apache.commons.math4.distribution.UniformIntegerDistribution;
import org.apache.commons.math4.exception.NumberIsTooLargeException;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Test cases for UniformIntegerDistribution. See class javadoc for
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/filter/KalmanFilterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/filter/KalmanFilterTest.java b/src/test/java/org/apache/commons/math4/filter/KalmanFilterTest.java
index 3bb50cb..744fe41 100644
--- a/src/test/java/org/apache/commons/math4/filter/KalmanFilterTest.java
+++ b/src/test/java/org/apache/commons/math4/filter/KalmanFilterTest.java
@@ -29,7 +29,7 @@ import org.apache.commons.math4.linear.RealMatrix;
import org.apache.commons.math4.linear.RealVector;
import org.apache.commons.rng.simple.RandomSource;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/fitting/WeightedObservedPointsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/WeightedObservedPointsTest.java b/src/test/java/org/apache/commons/math4/fitting/WeightedObservedPointsTest.java
index 773e883..1022847 100644
--- a/src/test/java/org/apache/commons/math4/fitting/WeightedObservedPointsTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/WeightedObservedPointsTest.java
@@ -22,7 +22,7 @@ import org.junit.Assert;
import org.junit.Test;
import org.apache.commons.math4.fitting.WeightedObservedPoint;
import org.apache.commons.math4.fitting.WeightedObservedPoints;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Tests {@link WeightedObservedPoints}.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTest.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTest.java
index f8bcc9d..43dd903 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTest.java
@@ -31,7 +31,7 @@ import org.apache.commons.math4.linear.RealVector;
import org.apache.commons.math4.linear.SingularMatrixException;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.Pair;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java
index 5d4a4d7..d0b9d4d 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java
@@ -35,7 +35,7 @@ import org.apache.commons.math4.linear.RealVector;
import org.apache.commons.math4.linear.SingularMatrixException;
import org.apache.commons.math4.optim.ConvergenceChecker;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalTest.java
index 3c85434..e4a88d3 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalTest.java
@@ -19,7 +19,7 @@ package org.apache.commons.math4.geometry.euclidean.oned;
import org.apache.commons.math4.geometry.euclidean.oned.Interval;
import org.apache.commons.math4.geometry.partitioning.Region;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.apache.commons.math4.exception.NumberIsTooSmallException;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSetTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSetTest.java
index b7c8399..de5d9e0 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSetTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSetTest.java
@@ -25,7 +25,7 @@ import org.apache.commons.math4.geometry.euclidean.oned.Vector1D;
import org.apache.commons.math4.geometry.partitioning.Region;
import org.apache.commons.math4.geometry.partitioning.RegionFactory;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DTest.java
index 0bf6b84..7029d94 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DTest.java
@@ -27,7 +27,7 @@ import org.apache.commons.math4.exception.MathArithmeticException;
import org.apache.commons.math4.geometry.Space;
import org.apache.commons.math4.geometry.euclidean.oned.Vector1D;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java
index e832ea8..1d7d248 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java
@@ -30,7 +30,7 @@ import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
import org.apache.commons.rng.UniformRandomProvider;
import org.apache.commons.rng.simple.RandomSource;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PLYParser.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PLYParser.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PLYParser.java
index 7670e69..24ac99c 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PLYParser.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PLYParser.java
@@ -27,7 +27,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/** This class is a small and incomplete parser for PLY files.
* <p>
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java
index dbf1b3e..530a06a 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java
@@ -31,7 +31,7 @@ import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
import org.apache.commons.rng.UniformRandomProvider;
import org.apache.commons.rng.simple.RandomSource;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
index 818c109..46d0aa4 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
@@ -33,7 +33,7 @@ import org.apache.commons.rng.UniformRandomProvider;
import org.apache.commons.rng.simple.RandomSource;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathArrays;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcTest.java b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcTest.java
index 0f707bb..3a2e6b1 100644
--- a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcTest.java
@@ -21,7 +21,7 @@ import org.apache.commons.math4.geometry.partitioning.Region;
import org.apache.commons.math4.geometry.spherical.oned.Arc;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathUtils;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSetTest.java b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSetTest.java
index 6f86857..663af6a 100644
--- a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSetTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSetTest.java
@@ -36,7 +36,7 @@ import org.apache.commons.math4.geometry.spherical.oned.Sphere1D;
import org.apache.commons.math4.geometry.spherical.oned.SubLimitAngle;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathUtils;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/linear/DiagonalMatrixTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/DiagonalMatrixTest.java b/src/test/java/org/apache/commons/math4/linear/DiagonalMatrixTest.java
index fb41169..388fc07 100644
--- a/src/test/java/org/apache/commons/math4/linear/DiagonalMatrixTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/DiagonalMatrixTest.java
@@ -27,7 +27,7 @@ import org.apache.commons.math4.linear.MatrixUtils;
import org.apache.commons.math4.linear.RealMatrix;
import org.apache.commons.math4.linear.RealVector;
import org.apache.commons.math4.linear.SingularMatrixException;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/linear/EigenDecompositionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/EigenDecompositionTest.java b/src/test/java/org/apache/commons/math4/linear/EigenDecompositionTest.java
index e189d19..df472a2 100644
--- a/src/test/java/org/apache/commons/math4/linear/EigenDecompositionTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/EigenDecompositionTest.java
@@ -32,7 +32,7 @@ import org.apache.commons.math4.linear.RealVector;
import org.apache.commons.math4.linear.TriDiagonalTransformer;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathArrays;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.apache.commons.rng.simple.RandomSource;
import org.junit.After;
import org.junit.Assert;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/linear/EigenSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/EigenSolverTest.java b/src/test/java/org/apache/commons/math4/linear/EigenSolverTest.java
index 541a8a7..cf0794f 100644
--- a/src/test/java/org/apache/commons/math4/linear/EigenSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/EigenSolverTest.java
@@ -25,7 +25,7 @@ import org.apache.commons.math4.linear.EigenDecomposition;
import org.apache.commons.math4.linear.MatrixUtils;
import org.apache.commons.math4.linear.RealMatrix;
import org.apache.commons.math4.linear.SingularMatrixException;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Test;
import org.junit.Assert;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/optim/linear/SimplexSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/linear/SimplexSolverTest.java b/src/test/java/org/apache/commons/math4/optim/linear/SimplexSolverTest.java
index 503f782..c540652 100644
--- a/src/test/java/org/apache/commons/math4/optim/linear/SimplexSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/linear/SimplexSolverTest.java
@@ -35,7 +35,7 @@ import org.apache.commons.math4.optim.linear.SimplexSolver;
import org.apache.commons.math4.optim.linear.SolutionCallback;
import org.apache.commons.math4.optim.linear.UnboundedSolutionException;
import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Test;
import org.junit.Assert;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/stat/StatUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/StatUtilsTest.java b/src/test/java/org/apache/commons/math4/stat/StatUtilsTest.java
index eae66fb..d10c8f4 100644
--- a/src/test/java/org/apache/commons/math4/stat/StatUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/StatUtilsTest.java
@@ -23,7 +23,7 @@ import org.apache.commons.math4.exception.NullArgumentException;
import org.apache.commons.math4.stat.StatUtils;
import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatisticsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatisticsTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatisticsTest.java
index 7767605..2f31b4c 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatisticsTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatisticsTest.java
@@ -26,7 +26,7 @@ import org.apache.commons.math4.distribution.RealDistribution;
import org.apache.commons.math4.distribution.AbstractRealDistribution;
import org.apache.commons.math4.distribution.UniformIntegerDistribution;
import org.apache.commons.math4.distribution.UniformRealDistribution;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.apache.commons.rng.simple.RandomSource;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/stat/descriptive/DescriptiveStatisticsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/DescriptiveStatisticsTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/DescriptiveStatisticsTest.java
index e11e171..d5a4ae4 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/DescriptiveStatisticsTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/DescriptiveStatisticsTest.java
@@ -28,7 +28,7 @@ import org.apache.commons.math4.stat.descriptive.rank.Min;
import org.apache.commons.math4.stat.descriptive.rank.Percentile;
import org.apache.commons.math4.stat.descriptive.summary.Sum;
import org.apache.commons.math4.stat.descriptive.summary.SumOfSquares;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/transform/FastHadamardTransformerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/transform/FastHadamardTransformerTest.java b/src/test/java/org/apache/commons/math4/transform/FastHadamardTransformerTest.java
index 8fe0173..4513732 100644
--- a/src/test/java/org/apache/commons/math4/transform/FastHadamardTransformerTest.java
+++ b/src/test/java/org/apache/commons/math4/transform/FastHadamardTransformerTest.java
@@ -19,7 +19,7 @@ package org.apache.commons.math4.transform;
import org.apache.commons.math4.exception.MathIllegalArgumentException;
import org.apache.commons.math4.transform.FastHadamardTransformer;
import org.apache.commons.math4.transform.TransformType;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/util/FastMathStrictComparisonTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/FastMathStrictComparisonTest.java b/src/test/java/org/apache/commons/math4/util/FastMathStrictComparisonTest.java
index d38d42e..38e39ca 100644
--- a/src/test/java/org/apache/commons/math4/util/FastMathStrictComparisonTest.java
+++ b/src/test/java/org/apache/commons/math4/util/FastMathStrictComparisonTest.java
@@ -26,7 +26,7 @@ import java.util.List;
import org.apache.commons.math4.exception.MathArithmeticException;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/util/FastMathTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/FastMathTest.java b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
index 125a02d..702510a 100644
--- a/src/test/java/org/apache/commons/math4/util/FastMathTest.java
+++ b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
@@ -27,6 +27,7 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
+import org.apache.commons.numbers.core.Precision;
import org.apache.commons.math4.TestUtils;
import org.apache.commons.math4.dfp.Dfp;
import org.apache.commons.math4.dfp.DfpField;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/util/MathArraysTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/MathArraysTest.java b/src/test/java/org/apache/commons/math4/util/MathArraysTest.java
index 0f0f06c..950b980 100644
--- a/src/test/java/org/apache/commons/math4/util/MathArraysTest.java
+++ b/src/test/java/org/apache/commons/math4/util/MathArraysTest.java
@@ -29,7 +29,7 @@ import org.apache.commons.rng.UniformRandomProvider;
import org.apache.commons.rng.simple.RandomSource;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathArrays;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java b/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java
index 5da2f71..4223f1d 100644
--- a/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java
+++ b/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java
@@ -25,7 +25,7 @@ import java.util.Random;
import java.util.Set;
import org.apache.commons.math4.util.OpenIntToDoubleHashMap;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/util/PrecisionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/PrecisionTest.java b/src/test/java/org/apache/commons/math4/util/PrecisionTest.java
deleted file mode 100644
index 3d133d7..0000000
--- a/src/test/java/org/apache/commons/math4/util/PrecisionTest.java
+++ /dev/null
@@ -1,553 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
- * or agreed to in writing, software distributed under the License is
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-package org.apache.commons.math4.util;
-
-import java.math.BigDecimal;
-
-import org.apache.commons.math4.TestUtils;
-import org.apache.commons.math4.exception.MathArithmeticException;
-import org.apache.commons.math4.exception.MathIllegalArgumentException;
-import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Test cases for the {@link Precision} class.
- *
- */
-public class PrecisionTest {
- @Test
- public void testEqualsWithRelativeTolerance() {
- Assert.assertTrue(Precision.equalsWithRelativeTolerance(0d, 0d, 0d));
- Assert.assertTrue(Precision.equalsWithRelativeTolerance(0d, 1 / Double.NEGATIVE_INFINITY, 0d));
-
- final double eps = 1e-14;
- Assert.assertFalse(Precision.equalsWithRelativeTolerance(1.987654687654968, 1.987654687654988, eps));
- Assert.assertTrue(Precision.equalsWithRelativeTolerance(1.987654687654968, 1.987654687654987, eps));
- Assert.assertFalse(Precision.equalsWithRelativeTolerance(1.987654687654968, 1.987654687654948, eps));
- Assert.assertTrue(Precision.equalsWithRelativeTolerance(1.987654687654968, 1.987654687654949, eps));
-
- Assert.assertFalse(Precision.equalsWithRelativeTolerance(Precision.SAFE_MIN, 0.0, eps));
-
- Assert.assertFalse(Precision.equalsWithRelativeTolerance(1.0000000000001e-300, 1e-300, eps));
- Assert.assertTrue(Precision.equalsWithRelativeTolerance(1.00000000000001e-300, 1e-300, eps));
-
- Assert.assertFalse(Precision.equalsWithRelativeTolerance(Double.NEGATIVE_INFINITY, 1.23, eps));
- Assert.assertFalse(Precision.equalsWithRelativeTolerance(Double.POSITIVE_INFINITY, 1.23, eps));
-
- Assert.assertTrue(Precision.equalsWithRelativeTolerance(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, eps));
- Assert.assertTrue(Precision.equalsWithRelativeTolerance(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, eps));
- Assert.assertFalse(Precision.equalsWithRelativeTolerance(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, eps));
-
- Assert.assertFalse(Precision.equalsWithRelativeTolerance(Double.NaN, 1.23, eps));
- Assert.assertFalse(Precision.equalsWithRelativeTolerance(Double.NaN, Double.NaN, eps));
- }
-
- @Test
- public void testEqualsIncludingNaN() {
- double[] testArray = {
- Double.NaN,
- Double.POSITIVE_INFINITY,
- Double.NEGATIVE_INFINITY,
- 1d,
- 0d };
- for (int i = 0; i < testArray.length; i++) {
- for (int j = 0; j < testArray.length; j++) {
- if (i == j) {
- Assert.assertTrue(Precision.equalsIncludingNaN(testArray[i], testArray[j]));
- Assert.assertTrue(Precision.equalsIncludingNaN(testArray[j], testArray[i]));
- } else {
- Assert.assertTrue(!Precision.equalsIncludingNaN(testArray[i], testArray[j]));
- Assert.assertTrue(!Precision.equalsIncludingNaN(testArray[j], testArray[i]));
- }
- }
- }
- }
-
- @Test
- public void testEqualsWithAllowedDelta() {
- Assert.assertTrue(Precision.equals(153.0000, 153.0000, .0625));
- Assert.assertTrue(Precision.equals(153.0000, 153.0625, .0625));
- Assert.assertTrue(Precision.equals(152.9375, 153.0000, .0625));
- Assert.assertFalse(Precision.equals(153.0000, 153.0625, .0624));
- Assert.assertFalse(Precision.equals(152.9374, 153.0000, .0625));
- Assert.assertFalse(Precision.equals(Double.NaN, Double.NaN, 1.0));
- Assert.assertTrue(Precision.equals(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, 1.0));
- Assert.assertTrue(Precision.equals(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, 1.0));
- Assert.assertFalse(Precision.equals(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 1.0));
- }
-
- @Test
- public void testMath475() {
- final double a = 1.7976931348623182E16;
- final double b = FastMath.nextUp(a);
-
- double diff = FastMath.abs(a - b);
- // Because they are adjacent floating point numbers, "a" and "b" are
- // considered equal even though the allowed error is smaller than
- // their difference.
- Assert.assertTrue(Precision.equals(a, b, 0.5 * diff));
-
- final double c = FastMath.nextUp(b);
- diff = FastMath.abs(a - c);
- // Because "a" and "c" are not adjacent, the tolerance is taken into
- // account for assessing equality.
- Assert.assertTrue(Precision.equals(a, c, diff));
- Assert.assertFalse(Precision.equals(a, c, (1 - 1e-16) * diff));
- }
-
- @Test
- public void testEqualsIncludingNaNWithAllowedDelta() {
- Assert.assertTrue(Precision.equalsIncludingNaN(153.0000, 153.0000, .0625));
- Assert.assertTrue(Precision.equalsIncludingNaN(153.0000, 153.0625, .0625));
- Assert.assertTrue(Precision.equalsIncludingNaN(152.9375, 153.0000, .0625));
- Assert.assertTrue(Precision.equalsIncludingNaN(Double.NaN, Double.NaN, 1.0));
- Assert.assertTrue(Precision.equalsIncludingNaN(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, 1.0));
- Assert.assertTrue(Precision.equalsIncludingNaN(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, 1.0));
- Assert.assertFalse(Precision.equalsIncludingNaN(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 1.0));
- Assert.assertFalse(Precision.equalsIncludingNaN(153.0000, 153.0625, .0624));
- Assert.assertFalse(Precision.equalsIncludingNaN(152.9374, 153.0000, .0625));
- }
-
- // Tests for floating point equality
- @Test
- public void testFloatEqualsWithAllowedUlps() {
- Assert.assertTrue("+0.0f == -0.0f",Precision.equals(0.0f, -0.0f));
- Assert.assertTrue("+0.0f == -0.0f (1 ulp)",Precision.equals(0.0f, -0.0f, 1));
- float oneFloat = 1.0f;
- Assert.assertTrue("1.0f == 1.0f + 1 ulp",Precision.equals(oneFloat, Float.intBitsToFloat(1 + Float.floatToIntBits(oneFloat))));
- Assert.assertTrue("1.0f == 1.0f + 1 ulp (1 ulp)",Precision.equals(oneFloat, Float.intBitsToFloat(1 + Float.floatToIntBits(oneFloat)), 1));
- Assert.assertFalse("1.0f != 1.0f + 2 ulp (1 ulp)",Precision.equals(oneFloat, Float.intBitsToFloat(2 + Float.floatToIntBits(oneFloat)), 1));
-
- Assert.assertTrue(Precision.equals(153.0f, 153.0f, 1));
-
- // These tests need adjusting for floating point precision
-// Assert.assertTrue(Precision.equals(153.0f, 153.00000000000003f, 1));
-// Assert.assertFalse(Precision.equals(153.0f, 153.00000000000006f, 1));
-// Assert.assertTrue(Precision.equals(153.0f, 152.99999999999997f, 1));
-// Assert.assertFalse(Precision.equals(153f, 152.99999999999994f, 1));
-//
-// Assert.assertTrue(Precision.equals(-128.0f, -127.99999999999999f, 1));
-// Assert.assertFalse(Precision.equals(-128.0f, -127.99999999999997f, 1));
-// Assert.assertTrue(Precision.equals(-128.0f, -128.00000000000003f, 1));
-// Assert.assertFalse(Precision.equals(-128.0f, -128.00000000000006f, 1));
-
- Assert.assertTrue(Precision.equals(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, 1));
- Assert.assertTrue(Precision.equals(Double.MAX_VALUE, Float.POSITIVE_INFINITY, 1));
-
- Assert.assertTrue(Precision.equals(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY, 1));
- Assert.assertTrue(Precision.equals(-Float.MAX_VALUE, Float.NEGATIVE_INFINITY, 1));
-
- Assert.assertFalse(Precision.equals(Float.NaN, Float.NaN, 1));
- Assert.assertFalse(Precision.equals(Float.NaN, Float.NaN, 0));
- Assert.assertFalse(Precision.equals(Float.NaN, 0, 0));
- Assert.assertFalse(Precision.equals(Float.NaN, Float.POSITIVE_INFINITY, 0));
- Assert.assertFalse(Precision.equals(Float.NaN, Float.NEGATIVE_INFINITY, 0));
-
- Assert.assertFalse(Precision.equals(Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY, 100000));
- }
-
- @Test
- public void testEqualsWithAllowedUlps() {
- Assert.assertTrue(Precision.equals(0.0, -0.0, 1));
-
- Assert.assertTrue(Precision.equals(1.0, 1 + FastMath.ulp(1d), 1));
- Assert.assertFalse(Precision.equals(1.0, 1 + 2 * FastMath.ulp(1d), 1));
-
- final double nUp1 = FastMath.nextAfter(1d, Double.POSITIVE_INFINITY);
- final double nnUp1 = FastMath.nextAfter(nUp1, Double.POSITIVE_INFINITY);
- Assert.assertTrue(Precision.equals(1.0, nUp1, 1));
- Assert.assertTrue(Precision.equals(nUp1, nnUp1, 1));
- Assert.assertFalse(Precision.equals(1.0, nnUp1, 1));
-
- Assert.assertTrue(Precision.equals(0.0, FastMath.ulp(0d), 1));
- Assert.assertTrue(Precision.equals(0.0, -FastMath.ulp(0d), 1));
-
- Assert.assertTrue(Precision.equals(153.0, 153.0, 1));
-
- Assert.assertTrue(Precision.equals(153.0, 153.00000000000003, 1));
- Assert.assertFalse(Precision.equals(153.0, 153.00000000000006, 1));
- Assert.assertTrue(Precision.equals(153.0, 152.99999999999997, 1));
- Assert.assertFalse(Precision.equals(153, 152.99999999999994, 1));
-
- Assert.assertTrue(Precision.equals(-128.0, -127.99999999999999, 1));
- Assert.assertFalse(Precision.equals(-128.0, -127.99999999999997, 1));
- Assert.assertTrue(Precision.equals(-128.0, -128.00000000000003, 1));
- Assert.assertFalse(Precision.equals(-128.0, -128.00000000000006, 1));
-
- Assert.assertTrue(Precision.equals(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, 1));
- Assert.assertTrue(Precision.equals(Double.MAX_VALUE, Double.POSITIVE_INFINITY, 1));
-
- Assert.assertTrue(Precision.equals(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, 1));
- Assert.assertTrue(Precision.equals(-Double.MAX_VALUE, Double.NEGATIVE_INFINITY, 1));
-
- Assert.assertFalse(Precision.equals(Double.NaN, Double.NaN, 1));
- Assert.assertFalse(Precision.equals(Double.NaN, Double.NaN, 0));
- Assert.assertFalse(Precision.equals(Double.NaN, 0, 0));
- Assert.assertFalse(Precision.equals(Double.NaN, Double.POSITIVE_INFINITY, 0));
- Assert.assertFalse(Precision.equals(Double.NaN, Double.NEGATIVE_INFINITY, 0));
-
- Assert.assertFalse(Precision.equals(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 100000));
- }
-
- @Test
- public void testEqualsIncludingNaNWithAllowedUlps() {
- Assert.assertTrue(Precision.equalsIncludingNaN(0.0, -0.0, 1));
-
- Assert.assertTrue(Precision.equalsIncludingNaN(1.0, 1 + FastMath.ulp(1d), 1));
- Assert.assertFalse(Precision.equalsIncludingNaN(1.0, 1 + 2 * FastMath.ulp(1d), 1));
-
- final double nUp1 = FastMath.nextAfter(1d, Double.POSITIVE_INFINITY);
- final double nnUp1 = FastMath.nextAfter(nUp1, Double.POSITIVE_INFINITY);
- Assert.assertTrue(Precision.equalsIncludingNaN(1.0, nUp1, 1));
- Assert.assertTrue(Precision.equalsIncludingNaN(nUp1, nnUp1, 1));
- Assert.assertFalse(Precision.equalsIncludingNaN(1.0, nnUp1, 1));
-
- Assert.assertTrue(Precision.equalsIncludingNaN(0.0, FastMath.ulp(0d), 1));
- Assert.assertTrue(Precision.equalsIncludingNaN(0.0, -FastMath.ulp(0d), 1));
-
- Assert.assertTrue(Precision.equalsIncludingNaN(153.0, 153.0, 1));
-
- Assert.assertTrue(Precision.equalsIncludingNaN(153.0, 153.00000000000003, 1));
- Assert.assertFalse(Precision.equalsIncludingNaN(153.0, 153.00000000000006, 1));
- Assert.assertTrue(Precision.equalsIncludingNaN(153.0, 152.99999999999997, 1));
- Assert.assertFalse(Precision.equalsIncludingNaN(153, 152.99999999999994, 1));
-
- Assert.assertTrue(Precision.equalsIncludingNaN(-128.0, -127.99999999999999, 1));
- Assert.assertFalse(Precision.equalsIncludingNaN(-128.0, -127.99999999999997, 1));
- Assert.assertTrue(Precision.equalsIncludingNaN(-128.0, -128.00000000000003, 1));
- Assert.assertFalse(Precision.equalsIncludingNaN(-128.0, -128.00000000000006, 1));
-
- Assert.assertTrue(Precision.equalsIncludingNaN(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, 1));
- Assert.assertTrue(Precision.equalsIncludingNaN(Double.MAX_VALUE, Double.POSITIVE_INFINITY, 1));
-
- Assert.assertTrue(Precision.equalsIncludingNaN(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, 1));
- Assert.assertTrue(Precision.equalsIncludingNaN(-Double.MAX_VALUE, Double.NEGATIVE_INFINITY, 1));
-
- Assert.assertTrue(Precision.equalsIncludingNaN(Double.NaN, Double.NaN, 1));
-
- Assert.assertFalse(Precision.equalsIncludingNaN(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 100000));
- }
-
- @Test
- public void testCompareToEpsilon() {
- Assert.assertEquals(0, Precision.compareTo(152.33, 152.32, .011));
- Assert.assertTrue(Precision.compareTo(152.308, 152.32, .011) < 0);
- Assert.assertTrue(Precision.compareTo(152.33, 152.318, .011) > 0);
- Assert.assertEquals(0, Precision.compareTo(Double.MIN_VALUE, +0.0, Double.MIN_VALUE));
- Assert.assertEquals(0, Precision.compareTo(Double.MIN_VALUE, -0.0, Double.MIN_VALUE));
- }
-
- @Test
- public void testCompareToMaxUlps() {
- double a = 152.32;
- double delta = FastMath.ulp(a);
- for (int i = 0; i <= 10; ++i) {
- if (i <= 5) {
- Assert.assertEquals( 0, Precision.compareTo(a, a + i * delta, 5));
- Assert.assertEquals( 0, Precision.compareTo(a, a - i * delta, 5));
- } else {
- Assert.assertEquals(-1, Precision.compareTo(a, a + i * delta, 5));
- Assert.assertEquals(+1, Precision.compareTo(a, a - i * delta, 5));
- }
- }
-
- Assert.assertEquals( 0, Precision.compareTo(-0.0, 0.0, 0));
-
- Assert.assertEquals(-1, Precision.compareTo(-Double.MIN_VALUE, -0.0, 0));
- Assert.assertEquals( 0, Precision.compareTo(-Double.MIN_VALUE, -0.0, 1));
- Assert.assertEquals(-1, Precision.compareTo(-Double.MIN_VALUE, +0.0, 0));
- Assert.assertEquals( 0, Precision.compareTo(-Double.MIN_VALUE, +0.0, 1));
-
- Assert.assertEquals(+1, Precision.compareTo( Double.MIN_VALUE, -0.0, 0));
- Assert.assertEquals( 0, Precision.compareTo( Double.MIN_VALUE, -0.0, 1));
- Assert.assertEquals(+1, Precision.compareTo( Double.MIN_VALUE, +0.0, 0));
- Assert.assertEquals( 0, Precision.compareTo( Double.MIN_VALUE, +0.0, 1));
-
- Assert.assertEquals(-1, Precision.compareTo(-Double.MIN_VALUE, Double.MIN_VALUE, 0));
- Assert.assertEquals(-1, Precision.compareTo(-Double.MIN_VALUE, Double.MIN_VALUE, 1));
- Assert.assertEquals( 0, Precision.compareTo(-Double.MIN_VALUE, Double.MIN_VALUE, 2));
-
- Assert.assertEquals( 0, Precision.compareTo(Double.MAX_VALUE, Double.POSITIVE_INFINITY, 1));
- Assert.assertEquals(-1, Precision.compareTo(Double.MAX_VALUE, Double.POSITIVE_INFINITY, 0));
-
- Assert.assertEquals(+1, Precision.compareTo(Double.MAX_VALUE, Double.NaN, Integer.MAX_VALUE));
- Assert.assertEquals(+1, Precision.compareTo(Double.NaN, Double.MAX_VALUE, Integer.MAX_VALUE));
- }
-
- @Test
- public void testRoundDouble() {
- double x = 1.234567890;
- Assert.assertEquals(1.23, Precision.round(x, 2), 0.0);
- Assert.assertEquals(1.235, Precision.round(x, 3), 0.0);
- Assert.assertEquals(1.2346, Precision.round(x, 4), 0.0);
-
- // JIRA MATH-151
- Assert.assertEquals(39.25, Precision.round(39.245, 2), 0.0);
- Assert.assertEquals(39.24, Precision.round(39.245, 2, BigDecimal.ROUND_DOWN), 0.0);
- double xx = 39.0;
- xx += 245d / 1000d;
- Assert.assertEquals(39.25, Precision.round(xx, 2), 0.0);
-
- // BZ 35904
- Assert.assertEquals(30.1d, Precision.round(30.095d, 2), 0.0d);
- Assert.assertEquals(30.1d, Precision.round(30.095d, 1), 0.0d);
- Assert.assertEquals(33.1d, Precision.round(33.095d, 1), 0.0d);
- Assert.assertEquals(33.1d, Precision.round(33.095d, 2), 0.0d);
- Assert.assertEquals(50.09d, Precision.round(50.085d, 2), 0.0d);
- Assert.assertEquals(50.19d, Precision.round(50.185d, 2), 0.0d);
- Assert.assertEquals(50.01d, Precision.round(50.005d, 2), 0.0d);
- Assert.assertEquals(30.01d, Precision.round(30.005d, 2), 0.0d);
- Assert.assertEquals(30.65d, Precision.round(30.645d, 2), 0.0d);
-
- Assert.assertEquals(1.24, Precision.round(x, 2, BigDecimal.ROUND_CEILING), 0.0);
- Assert.assertEquals(1.235, Precision.round(x, 3, BigDecimal.ROUND_CEILING), 0.0);
- Assert.assertEquals(1.2346, Precision.round(x, 4, BigDecimal.ROUND_CEILING), 0.0);
- Assert.assertEquals(-1.23, Precision.round(-x, 2, BigDecimal.ROUND_CEILING), 0.0);
- Assert.assertEquals(-1.234, Precision.round(-x, 3, BigDecimal.ROUND_CEILING), 0.0);
- Assert.assertEquals(-1.2345, Precision.round(-x, 4, BigDecimal.ROUND_CEILING), 0.0);
-
- Assert.assertEquals(1.23, Precision.round(x, 2, BigDecimal.ROUND_DOWN), 0.0);
- Assert.assertEquals(1.234, Precision.round(x, 3, BigDecimal.ROUND_DOWN), 0.0);
- Assert.assertEquals(1.2345, Precision.round(x, 4, BigDecimal.ROUND_DOWN), 0.0);
- Assert.assertEquals(-1.23, Precision.round(-x, 2, BigDecimal.ROUND_DOWN), 0.0);
- Assert.assertEquals(-1.234, Precision.round(-x, 3, BigDecimal.ROUND_DOWN), 0.0);
- Assert.assertEquals(-1.2345, Precision.round(-x, 4, BigDecimal.ROUND_DOWN), 0.0);
-
- Assert.assertEquals(1.23, Precision.round(x, 2, BigDecimal.ROUND_FLOOR), 0.0);
- Assert.assertEquals(1.234, Precision.round(x, 3, BigDecimal.ROUND_FLOOR), 0.0);
- Assert.assertEquals(1.2345, Precision.round(x, 4, BigDecimal.ROUND_FLOOR), 0.0);
- Assert.assertEquals(-1.24, Precision.round(-x, 2, BigDecimal.ROUND_FLOOR), 0.0);
- Assert.assertEquals(-1.235, Precision.round(-x, 3, BigDecimal.ROUND_FLOOR), 0.0);
- Assert.assertEquals(-1.2346, Precision.round(-x, 4, BigDecimal.ROUND_FLOOR), 0.0);
-
- Assert.assertEquals(1.23, Precision.round(x, 2, BigDecimal.ROUND_HALF_DOWN), 0.0);
- Assert.assertEquals(1.235, Precision.round(x, 3, BigDecimal.ROUND_HALF_DOWN), 0.0);
- Assert.assertEquals(1.2346, Precision.round(x, 4, BigDecimal.ROUND_HALF_DOWN), 0.0);
- Assert.assertEquals(-1.23, Precision.round(-x, 2, BigDecimal.ROUND_HALF_DOWN), 0.0);
- Assert.assertEquals(-1.235, Precision.round(-x, 3, BigDecimal.ROUND_HALF_DOWN), 0.0);
- Assert.assertEquals(-1.2346, Precision.round(-x, 4, BigDecimal.ROUND_HALF_DOWN), 0.0);
- Assert.assertEquals(1.234, Precision.round(1.2345, 3, BigDecimal.ROUND_HALF_DOWN), 0.0);
- Assert.assertEquals(-1.234, Precision.round(-1.2345, 3, BigDecimal.ROUND_HALF_DOWN), 0.0);
-
- Assert.assertEquals(1.23, Precision.round(x, 2, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(1.235, Precision.round(x, 3, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(1.2346, Precision.round(x, 4, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(-1.23, Precision.round(-x, 2, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(-1.235, Precision.round(-x, 3, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(-1.2346, Precision.round(-x, 4, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(1.234, Precision.round(1.2345, 3, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(-1.234, Precision.round(-1.2345, 3, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(1.236, Precision.round(1.2355, 3, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(-1.236, Precision.round(-1.2355, 3, BigDecimal.ROUND_HALF_EVEN), 0.0);
-
- Assert.assertEquals(1.23, Precision.round(x, 2, BigDecimal.ROUND_HALF_UP), 0.0);
- Assert.assertEquals(1.235, Precision.round(x, 3, BigDecimal.ROUND_HALF_UP), 0.0);
- Assert.assertEquals(1.2346, Precision.round(x, 4, BigDecimal.ROUND_HALF_UP), 0.0);
- Assert.assertEquals(-1.23, Precision.round(-x, 2, BigDecimal.ROUND_HALF_UP), 0.0);
- Assert.assertEquals(-1.235, Precision.round(-x, 3, BigDecimal.ROUND_HALF_UP), 0.0);
- Assert.assertEquals(-1.2346, Precision.round(-x, 4, BigDecimal.ROUND_HALF_UP), 0.0);
- Assert.assertEquals(1.235, Precision.round(1.2345, 3, BigDecimal.ROUND_HALF_UP), 0.0);
- Assert.assertEquals(-1.235, Precision.round(-1.2345, 3, BigDecimal.ROUND_HALF_UP), 0.0);
-
- Assert.assertEquals(-1.23, Precision.round(-1.23, 2, BigDecimal.ROUND_UNNECESSARY), 0.0);
- Assert.assertEquals(1.23, Precision.round(1.23, 2, BigDecimal.ROUND_UNNECESSARY), 0.0);
-
- try {
- Precision.round(1.234, 2, BigDecimal.ROUND_UNNECESSARY);
- Assert.fail();
- } catch (ArithmeticException ex) {
- // expected
- }
-
- Assert.assertEquals(1.24, Precision.round(x, 2, BigDecimal.ROUND_UP), 0.0);
- Assert.assertEquals(1.235, Precision.round(x, 3, BigDecimal.ROUND_UP), 0.0);
- Assert.assertEquals(1.2346, Precision.round(x, 4, BigDecimal.ROUND_UP), 0.0);
- Assert.assertEquals(-1.24, Precision.round(-x, 2, BigDecimal.ROUND_UP), 0.0);
- Assert.assertEquals(-1.235, Precision.round(-x, 3, BigDecimal.ROUND_UP), 0.0);
- Assert.assertEquals(-1.2346, Precision.round(-x, 4, BigDecimal.ROUND_UP), 0.0);
-
- try {
- Precision.round(1.234, 2, 1923);
- Assert.fail();
- } catch (IllegalArgumentException ex) {
- // expected
- }
-
- // MATH-151
- Assert.assertEquals(39.25, Precision.round(39.245, 2, BigDecimal.ROUND_HALF_UP), 0.0);
-
- // special values
- TestUtils.assertEquals(Double.NaN, Precision.round(Double.NaN, 2), 0.0);
- Assert.assertEquals(0.0, Precision.round(0.0, 2), 0.0);
- Assert.assertEquals(Double.POSITIVE_INFINITY, Precision.round(Double.POSITIVE_INFINITY, 2), 0.0);
- Assert.assertEquals(Double.NEGATIVE_INFINITY, Precision.round(Double.NEGATIVE_INFINITY, 2), 0.0);
- // comparison of positive and negative zero is not possible -> always equal thus do string comparison
- Assert.assertEquals("-0.0", Double.toString(Precision.round(-0.0, 0)));
- Assert.assertEquals("-0.0", Double.toString(Precision.round(-1e-10, 0)));
- }
-
- @Test
- public void testRoundFloat() {
- float x = 1.234567890f;
- Assert.assertEquals(1.23f, Precision.round(x, 2), 0.0);
- Assert.assertEquals(1.235f, Precision.round(x, 3), 0.0);
- Assert.assertEquals(1.2346f, Precision.round(x, 4), 0.0);
-
- // BZ 35904
- Assert.assertEquals(30.1f, Precision.round(30.095f, 2), 0.0f);
- Assert.assertEquals(30.1f, Precision.round(30.095f, 1), 0.0f);
- Assert.assertEquals(50.09f, Precision.round(50.085f, 2), 0.0f);
- Assert.assertEquals(50.19f, Precision.round(50.185f, 2), 0.0f);
- Assert.assertEquals(50.01f, Precision.round(50.005f, 2), 0.0f);
- Assert.assertEquals(30.01f, Precision.round(30.005f, 2), 0.0f);
- Assert.assertEquals(30.65f, Precision.round(30.645f, 2), 0.0f);
-
- Assert.assertEquals(1.24f, Precision.round(x, 2, BigDecimal.ROUND_CEILING), 0.0);
- Assert.assertEquals(1.235f, Precision.round(x, 3, BigDecimal.ROUND_CEILING), 0.0);
- Assert.assertEquals(1.2346f, Precision.round(x, 4, BigDecimal.ROUND_CEILING), 0.0);
- Assert.assertEquals(-1.23f, Precision.round(-x, 2, BigDecimal.ROUND_CEILING), 0.0);
- Assert.assertEquals(-1.234f, Precision.round(-x, 3, BigDecimal.ROUND_CEILING), 0.0);
- Assert.assertEquals(-1.2345f, Precision.round(-x, 4, BigDecimal.ROUND_CEILING), 0.0);
-
- Assert.assertEquals(1.23f, Precision.round(x, 2, BigDecimal.ROUND_DOWN), 0.0);
- Assert.assertEquals(1.234f, Precision.round(x, 3, BigDecimal.ROUND_DOWN), 0.0);
- Assert.assertEquals(1.2345f, Precision.round(x, 4, BigDecimal.ROUND_DOWN), 0.0);
- Assert.assertEquals(-1.23f, Precision.round(-x, 2, BigDecimal.ROUND_DOWN), 0.0);
- Assert.assertEquals(-1.234f, Precision.round(-x, 3, BigDecimal.ROUND_DOWN), 0.0);
- Assert.assertEquals(-1.2345f, Precision.round(-x, 4, BigDecimal.ROUND_DOWN), 0.0);
-
- Assert.assertEquals(1.23f, Precision.round(x, 2, BigDecimal.ROUND_FLOOR), 0.0);
- Assert.assertEquals(1.234f, Precision.round(x, 3, BigDecimal.ROUND_FLOOR), 0.0);
- Assert.assertEquals(1.2345f, Precision.round(x, 4, BigDecimal.ROUND_FLOOR), 0.0);
- Assert.assertEquals(-1.24f, Precision.round(-x, 2, BigDecimal.ROUND_FLOOR), 0.0);
- Assert.assertEquals(-1.235f, Precision.round(-x, 3, BigDecimal.ROUND_FLOOR), 0.0);
- Assert.assertEquals(-1.2346f, Precision.round(-x, 4, BigDecimal.ROUND_FLOOR), 0.0);
-
- Assert.assertEquals(1.23f, Precision.round(x, 2, BigDecimal.ROUND_HALF_DOWN), 0.0);
- Assert.assertEquals(1.235f, Precision.round(x, 3, BigDecimal.ROUND_HALF_DOWN), 0.0);
- Assert.assertEquals(1.2346f, Precision.round(x, 4, BigDecimal.ROUND_HALF_DOWN), 0.0);
- Assert.assertEquals(-1.23f, Precision.round(-x, 2, BigDecimal.ROUND_HALF_DOWN), 0.0);
- Assert.assertEquals(-1.235f, Precision.round(-x, 3, BigDecimal.ROUND_HALF_DOWN), 0.0);
- Assert.assertEquals(-1.2346f, Precision.round(-x, 4, BigDecimal.ROUND_HALF_DOWN), 0.0);
- Assert.assertEquals(1.234f, Precision.round(1.2345f, 3, BigDecimal.ROUND_HALF_DOWN), 0.0);
- Assert.assertEquals(-1.234f, Precision.round(-1.2345f, 3, BigDecimal.ROUND_HALF_DOWN), 0.0);
-
- Assert.assertEquals(1.23f, Precision.round(x, 2, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(1.235f, Precision.round(x, 3, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(1.2346f, Precision.round(x, 4, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(-1.23f, Precision.round(-x, 2, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(-1.235f, Precision.round(-x, 3, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(-1.2346f, Precision.round(-x, 4, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(1.234f, Precision.round(1.2345f, 3, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(-1.234f, Precision.round(-1.2345f, 3, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(1.236f, Precision.round(1.2355f, 3, BigDecimal.ROUND_HALF_EVEN), 0.0);
- Assert.assertEquals(-1.236f, Precision.round(-1.2355f, 3, BigDecimal.ROUND_HALF_EVEN), 0.0);
-
- Assert.assertEquals(1.23f, Precision.round(x, 2, BigDecimal.ROUND_HALF_UP), 0.0);
- Assert.assertEquals(1.235f, Precision.round(x, 3, BigDecimal.ROUND_HALF_UP), 0.0);
- Assert.assertEquals(1.2346f, Precision.round(x, 4, BigDecimal.ROUND_HALF_UP), 0.0);
- Assert.assertEquals(-1.23f, Precision.round(-x, 2, BigDecimal.ROUND_HALF_UP), 0.0);
- Assert.assertEquals(-1.235f, Precision.round(-x, 3, BigDecimal.ROUND_HALF_UP), 0.0);
- Assert.assertEquals(-1.2346f, Precision.round(-x, 4, BigDecimal.ROUND_HALF_UP), 0.0);
- Assert.assertEquals(1.235f, Precision.round(1.2345f, 3, BigDecimal.ROUND_HALF_UP), 0.0);
- Assert.assertEquals(-1.235f, Precision.round(-1.2345f, 3, BigDecimal.ROUND_HALF_UP), 0.0);
-
- Assert.assertEquals(-1.23f, Precision.round(-1.23f, 2, BigDecimal.ROUND_UNNECESSARY), 0.0);
- Assert.assertEquals(1.23f, Precision.round(1.23f, 2, BigDecimal.ROUND_UNNECESSARY), 0.0);
-
- try {
- Precision.round(1.234f, 2, BigDecimal.ROUND_UNNECESSARY);
- Assert.fail();
- } catch (MathArithmeticException ex) {
- // success
- }
-
- Assert.assertEquals(1.24f, Precision.round(x, 2, BigDecimal.ROUND_UP), 0.0);
- Assert.assertEquals(1.235f, Precision.round(x, 3, BigDecimal.ROUND_UP), 0.0);
- Assert.assertEquals(1.2346f, Precision.round(x, 4, BigDecimal.ROUND_UP), 0.0);
- Assert.assertEquals(-1.24f, Precision.round(-x, 2, BigDecimal.ROUND_UP), 0.0);
- Assert.assertEquals(-1.235f, Precision.round(-x, 3, BigDecimal.ROUND_UP), 0.0);
- Assert.assertEquals(-1.2346f, Precision.round(-x, 4, BigDecimal.ROUND_UP), 0.0);
-
- try {
- Precision.round(1.234f, 2, 1923);
- Assert.fail();
- } catch (MathIllegalArgumentException ex) {
- // success
- }
-
- // special values
- TestUtils.assertEquals(Float.NaN, Precision.round(Float.NaN, 2), 0.0f);
- Assert.assertEquals(0.0f, Precision.round(0.0f, 2), 0.0f);
- Assert.assertEquals(Float.POSITIVE_INFINITY, Precision.round(Float.POSITIVE_INFINITY, 2), 0.0f);
- Assert.assertEquals(Float.NEGATIVE_INFINITY, Precision.round(Float.NEGATIVE_INFINITY, 2), 0.0f);
- // comparison of positive and negative zero is not possible -> always equal thus do string comparison
- Assert.assertEquals("-0.0", Float.toString(Precision.round(-0.0f, 0)));
- Assert.assertEquals("-0.0", Float.toString(Precision.round(-1e-10f, 0)));
-
- // MATH-1070
- Assert.assertEquals(0.0f, Precision.round(0f, 2, BigDecimal.ROUND_UP), 0.0f);
- Assert.assertEquals(0.05f, Precision.round(0.05f, 2, BigDecimal.ROUND_UP), 0.0f);
- Assert.assertEquals(0.06f, Precision.round(0.051f, 2, BigDecimal.ROUND_UP), 0.0f);
- Assert.assertEquals(0.06f, Precision.round(0.0505f, 2, BigDecimal.ROUND_UP), 0.0f);
- Assert.assertEquals(0.06f, Precision.round(0.059f, 2, BigDecimal.ROUND_UP), 0.0f);
- }
-
-
- @Test
- public void testIssue721() {
- Assert.assertEquals(-53, FastMath.getExponent(Precision.EPSILON));
- Assert.assertEquals(-1022, FastMath.getExponent(Precision.SAFE_MIN));
- }
-
-
- @Test
- public void testRepresentableDelta() {
- int nonRepresentableCount = 0;
- final double x = 100;
- final int numTrials = 10000;
- for (int i = 0; i < numTrials; i++) {
- final double originalDelta = FastMath.random();
- final double delta = Precision.representableDelta(x, originalDelta);
- if (delta != originalDelta) {
- ++nonRepresentableCount;
- }
- }
-
- Assert.assertTrue(nonRepresentableCount / (double) numTrials > 0.9);
- }
-
- @Test
- public void testMath843() {
- final double afterEpsilon = FastMath.nextAfter(Precision.EPSILON,
- Double.POSITIVE_INFINITY);
-
- // a) 1 + EPSILON is equal to 1.
- Assert.assertTrue(1 + Precision.EPSILON == 1);
-
- // b) 1 + "the number after EPSILON" is not equal to 1.
- Assert.assertFalse(1 + afterEpsilon == 1);
- }
-
- @Test
- public void testMath1127() {
- Assert.assertFalse(Precision.equals(2.0, -2.0, 1));
- Assert.assertTrue(Precision.equals(0.0, -0.0, 0));
- Assert.assertFalse(Precision.equals(2.0f, -2.0f, 1));
- Assert.assertTrue(Precision.equals(0.0f, -0.0f, 0));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/userguide/java/org/apache/commons/math4/userguide/genetics/HelloWorldExample.java
----------------------------------------------------------------------
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/genetics/HelloWorldExample.java b/src/userguide/java/org/apache/commons/math4/userguide/genetics/HelloWorldExample.java
index a02cc8e..d5eeba0 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/genetics/HelloWorldExample.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/genetics/HelloWorldExample.java
@@ -35,7 +35,7 @@ import org.apache.commons.math4.genetics.Population;
import org.apache.commons.math4.genetics.StoppingCondition;
import org.apache.commons.math4.genetics.TournamentSelection;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
public class HelloWorldExample {
public static final int POPULATION_SIZE = 1000;
[4/4] [math] MATH-1416: Depend on "Commons Numbers".
Posted by er...@apache.org.
MATH-1416: Depend on "Commons Numbers".
Replaced class "Precision" by its equivalent in module "commons-numbers-core".
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/e082e0c4
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/e082e0c4
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/e082e0c4
Branch: refs/heads/master
Commit: e082e0c48ed611ce3aca949cb47d0e96c35788ef
Parents: ef2507a
Author: Gilles <er...@apache.org>
Authored: Thu May 4 01:19:44 2017 +0200
Committer: Gilles <er...@apache.org>
Committed: Thu May 4 01:19:44 2017 +0200
----------------------------------------------------------------------
.../differentiation/SparseGradient.java | 2 +-
.../math4/analysis/function/Gaussian.java | 2 +-
.../BaseAbstractUnivariateIntegrator.java | 2 +-
.../interpolation/AkimaSplineInterpolator.java | 2 +-
.../solvers/BracketingNthOrderBrentSolver.java | 2 +-
.../math4/analysis/solvers/BrentSolver.java | 2 +-
.../FieldBracketingNthOrderBrentSolver.java | 2 +-
.../apache/commons/math4/complex/Complex.java | 6 +-
.../commons/math4/complex/Quaternion.java | 2 +-
.../leastsquares/EvaluationRmsChecker.java | 2 +-
.../LevenbergMarquardtOptimizer.java | 2 +-
.../geometry/euclidean/oned/IntervalsSet.java | 2 +-
.../math4/geometry/euclidean/threed/Line.java | 2 +-
.../geometry/euclidean/twod/PolygonsSet.java | 2 +-
.../euclidean/twod/hull/ConvexHull2D.java | 2 +-
.../euclidean/twod/hull/MonotoneChain.java | 2 +-
.../math4/geometry/spherical/oned/Arc.java | 2 +-
.../math4/geometry/spherical/oned/ArcsSet.java | 2 +-
.../commons/math4/linear/DiagonalMatrix.java | 2 +-
.../math4/linear/EigenDecomposition.java | 2 +-
.../math4/linear/HessenbergTransformer.java | 2 +-
.../commons/math4/linear/MatrixUtils.java | 2 +-
.../commons/math4/linear/SchurTransformer.java | 2 +-
.../linear/SingularValueDecomposition.java | 2 +-
.../commons/math4/ml/neuralnet/Neuron.java | 2 +-
.../commons/math4/ode/AbstractIntegrator.java | 2 +-
.../commons/math4/ode/events/FilterType.java | 4 +-
.../commons/math4/ode/events/Transformer.java | 2 +-
.../math4/ode/sampling/FieldStepNormalizer.java | 2 +-
.../math4/ode/sampling/StepNormalizer.java | 2 +-
.../math4/optim/linear/SimplexSolver.java | 2 +-
.../math4/optim/linear/SimplexTableau.java | 2 +-
.../math4/optim/univariate/BrentOptimizer.java | 2 +-
.../AbstractStorelessUnivariateStatistic.java | 2 +-
.../MultivariateSummaryStatistics.java | 2 +-
.../descriptive/StatisticalSummaryValues.java | 2 +-
.../stat/descriptive/SummaryStatistics.java | 2 +-
.../descriptive/rank/PSquarePercentile.java | 2 +-
.../math4/stat/descriptive/rank/Percentile.java | 2 +-
.../regression/MillerUpdatingRegression.java | 2 +-
.../math4/stat/regression/SimpleRegression.java | 2 +-
.../commons/math4/util/ContinuedFraction.java | 1 +
.../org/apache/commons/math4/util/FastMath.java | 1 +
.../apache/commons/math4/util/MathArrays.java | 1 +
.../apache/commons/math4/util/Precision.java | 608 -------------------
.../org/apache/commons/math4/TestUtils.java | 2 +-
.../DerivativeStructureTest.java | 2 +-
.../function/HarmonicOscillatorTest.java | 2 +-
.../AkimaSplineInterpolatorTest.java | 2 +-
.../BicubicInterpolatingFunctionTest.java | 2 +-
...eBicubicSplineInterpolatingFunctionTest.java | 2 +-
.../TricubicInterpolatingFunctionTest.java | 2 +-
.../polynomials/PolynomialsUtilsTest.java | 2 +-
.../org/apache/commons/math4/dfp/DfpTest.java | 2 +-
.../ExponentialDistributionTest.java | 2 +-
.../distribution/GumbelDistributionTest.java | 2 +-
.../HypergeometricDistributionTest.java | 2 +-
.../distribution/LaplaceDistributionTest.java | 2 +-
.../distribution/LevyDistributionTest.java | 2 +-
.../distribution/LogisticsDistributionTest.java | 2 +-
.../distribution/NakagamiDistributionTest.java | 2 +-
.../UniformIntegerDistributionTest.java | 2 +-
.../commons/math4/filter/KalmanFilterTest.java | 2 +-
.../fitting/WeightedObservedPointsTest.java | 2 +-
.../fitting/leastsquares/EvaluationTest.java | 2 +-
.../LevenbergMarquardtOptimizerTest.java | 2 +-
.../geometry/euclidean/oned/IntervalTest.java | 2 +-
.../euclidean/oned/IntervalsSetTest.java | 2 +-
.../geometry/euclidean/oned/Vector1DTest.java | 2 +-
.../euclidean/threed/FieldVector3DTest.java | 2 +-
.../geometry/euclidean/threed/PLYParser.java | 2 +-
.../geometry/euclidean/threed/Vector3DTest.java | 2 +-
.../hull/ConvexHullGenerator2DAbstractTest.java | 2 +-
.../math4/geometry/spherical/oned/ArcTest.java | 2 +-
.../geometry/spherical/oned/ArcsSetTest.java | 2 +-
.../math4/linear/DiagonalMatrixTest.java | 2 +-
.../math4/linear/EigenDecompositionTest.java | 2 +-
.../commons/math4/linear/EigenSolverTest.java | 2 +-
.../math4/optim/linear/SimplexSolverTest.java | 2 +-
.../commons/math4/stat/StatUtilsTest.java | 2 +-
.../AggregateSummaryStatisticsTest.java | 2 +-
.../descriptive/DescriptiveStatisticsTest.java | 2 +-
.../transform/FastHadamardTransformerTest.java | 2 +-
.../util/FastMathStrictComparisonTest.java | 2 +-
.../apache/commons/math4/util/FastMathTest.java | 1 +
.../commons/math4/util/MathArraysTest.java | 2 +-
.../math4/util/OpenIntToDoubleHashMapTest.java | 2 +-
.../commons/math4/util/PrecisionTest.java | 553 -----------------
.../userguide/genetics/HelloWorldExample.java | 2 +-
89 files changed, 90 insertions(+), 1247 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java
index 643a975..c642fed 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java
@@ -28,7 +28,7 @@ import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathArrays;
import org.apache.commons.math4.util.MathUtils;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* First derivative computation with large number of variables.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java b/src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java
index e703ed3..08dcac0 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java
@@ -26,7 +26,7 @@ import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.exception.NotStrictlyPositiveException;
import org.apache.commons.math4.exception.NullArgumentException;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* <a href="http://en.wikipedia.org/wiki/Gaussian_function">
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java
index db1bfd5..595f18f 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java
@@ -80,7 +80,7 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte
* achieved due to large values or short mantissa length. If this
* should be the primary criterion for convergence rather then a
* safety measure, set the absolute accuracy to a ridiculously small value,
- * like {@link org.apache.commons.math4.util.Precision#SAFE_MIN Precision.SAFE_MIN}.</li>
+ * like {@link org.apache.commons.numbers.core.Precision#SAFE_MIN Precision.SAFE_MIN}.</li>
* <li>absolute accuracy:
* The default is usually chosen so that results in the interval
* -10..-0.1 and +0.1..+10 can be found with a reasonable accuracy. If the
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolator.java
index 100b927..089a7ac 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolator.java
@@ -25,7 +25,7 @@ import org.apache.commons.math4.exception.NumberIsTooSmallException;
import org.apache.commons.math4.exception.util.LocalizedFormats;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathArrays;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Computes a cubic spline interpolation for the data set using the Akima
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolver.java
index e519f02..8a185bb 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolver.java
@@ -24,7 +24,7 @@ import org.apache.commons.math4.exception.NumberIsTooLargeException;
import org.apache.commons.math4.exception.NumberIsTooSmallException;
import org.apache.commons.math4.exception.TooManyEvaluationsException;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* This class implements a modification of the <a
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/analysis/solvers/BrentSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/BrentSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/BrentSolver.java
index 3b9f322..9e1e551 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/BrentSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/BrentSolver.java
@@ -21,7 +21,7 @@ import org.apache.commons.math4.exception.NoBracketingException;
import org.apache.commons.math4.exception.NumberIsTooLargeException;
import org.apache.commons.math4.exception.TooManyEvaluationsException;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* This class implements the <a href="http://mathworld.wolfram.com/BrentsMethod.html">
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/analysis/solvers/FieldBracketingNthOrderBrentSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/FieldBracketingNthOrderBrentSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/FieldBracketingNthOrderBrentSolver.java
index 75871f3..9b902fd 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/FieldBracketingNthOrderBrentSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/FieldBracketingNthOrderBrentSolver.java
@@ -27,7 +27,7 @@ import org.apache.commons.math4.exception.NumberIsTooSmallException;
import org.apache.commons.math4.util.IntegerSequence;
import org.apache.commons.math4.util.MathArrays;
import org.apache.commons.math4.util.MathUtils;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* This class implements a modification of the <a
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/complex/Complex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/complex/Complex.java b/src/main/java/org/apache/commons/math4/complex/Complex.java
index 48b17fc..f283397 100644
--- a/src/main/java/org/apache/commons/math4/complex/Complex.java
+++ b/src/main/java/org/apache/commons/math4/complex/Complex.java
@@ -27,7 +27,7 @@ import org.apache.commons.math4.exception.NullArgumentException;
import org.apache.commons.math4.exception.util.LocalizedFormats;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathUtils;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Representation of a Complex number, i.e. a number which has both a
@@ -46,8 +46,8 @@ import org.apache.commons.math4.util.Precision;
* Note that this contradicts the IEEE-754 standard for floating
* point numbers (according to which the test {@code x == x} must fail if
* {@code x} is {@code NaN}). The method
- * {@link org.apache.commons.math4.util.Precision#equals(double,double,int)
- * equals for primitive double} in {@link org.apache.commons.math4.util.Precision}
+ * {@link org.apache.commons.numbers.core.Precision#equals(double,double,int)
+ * equals for primitive double} in {@link org.apache.commons.numbers.core.Precision}
* conforms with IEEE-754 while this class conforms with the standard behavior
* for Java object types.</p>
*
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/complex/Quaternion.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/complex/Quaternion.java b/src/main/java/org/apache/commons/math4/complex/Quaternion.java
index 505b64e..0394d18 100644
--- a/src/main/java/org/apache/commons/math4/complex/Quaternion.java
+++ b/src/main/java/org/apache/commons/math4/complex/Quaternion.java
@@ -24,7 +24,7 @@ import org.apache.commons.math4.exception.ZeroException;
import org.apache.commons.math4.exception.util.LocalizedFormats;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathUtils;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* This class implements <a href="http://mathworld.wolfram.com/Quaternion.html">
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/fitting/leastsquares/EvaluationRmsChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/EvaluationRmsChecker.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/EvaluationRmsChecker.java
index 86b8463..3872323 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/EvaluationRmsChecker.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/EvaluationRmsChecker.java
@@ -18,7 +18,7 @@ package org.apache.commons.math4.fitting.leastsquares;
import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem.Evaluation;
import org.apache.commons.math4.optim.ConvergenceChecker;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Check if an optimization has converged based on the change in computed RMS.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizer.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizer.java
index c7a721a..9e256d1 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizer.java
@@ -26,7 +26,7 @@ import org.apache.commons.math4.linear.RealMatrix;
import org.apache.commons.math4.optim.ConvergenceChecker;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.Incrementor;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSet.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSet.java
index 1b58cd9..7282da5 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSet.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSet.java
@@ -27,7 +27,7 @@ import org.apache.commons.math4.geometry.partitioning.AbstractRegion;
import org.apache.commons.math4.geometry.partitioning.BSPTree;
import org.apache.commons.math4.geometry.partitioning.BoundaryProjection;
import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/** This class represents a 1D region: a set of intervals.
* @since 3.0
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Line.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Line.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Line.java
index 3173ac2..6b14f6e 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Line.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Line.java
@@ -25,7 +25,7 @@ import org.apache.commons.math4.geometry.euclidean.oned.IntervalsSet;
import org.apache.commons.math4.geometry.euclidean.oned.Vector1D;
import org.apache.commons.math4.geometry.partitioning.Embedding;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/** The class represent lines in a three dimensional space.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.java
index 38b94f4..b006e32 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.java
@@ -34,7 +34,7 @@ import org.apache.commons.math4.geometry.partitioning.Hyperplane;
import org.apache.commons.math4.geometry.partitioning.Side;
import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/** This class represents a 2D region: a set of polygons.
* @since 3.0
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHull2D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHull2D.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHull2D.java
index 7356da1..86076ba 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHull2D.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHull2D.java
@@ -29,7 +29,7 @@ import org.apache.commons.math4.geometry.hull.ConvexHull;
import org.apache.commons.math4.geometry.partitioning.Region;
import org.apache.commons.math4.geometry.partitioning.RegionFactory;
import org.apache.commons.math4.util.MathArrays;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* This class represents a convex hull in an two-dimensional euclidean space.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChain.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChain.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChain.java
index 5746c7f..8497da1 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChain.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChain.java
@@ -25,7 +25,7 @@ import java.util.List;
import org.apache.commons.math4.geometry.euclidean.twod.Line;
import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Implements Andrew's monotone chain method to generate the convex hull of a finite set of
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/geometry/spherical/oned/Arc.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/Arc.java b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/Arc.java
index b175250..84c6c5c 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/Arc.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/Arc.java
@@ -21,7 +21,7 @@ import org.apache.commons.math4.exception.util.LocalizedFormats;
import org.apache.commons.math4.geometry.partitioning.Region.Location;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathUtils;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/** This class represents an arc on a circle.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.java b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.java
index bc1e390..3e33c81 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.java
@@ -34,7 +34,7 @@ import org.apache.commons.math4.geometry.partitioning.Side;
import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathUtils;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/** This class represents a region of a circle: a set of arcs.
* <p>
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/linear/DiagonalMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/DiagonalMatrix.java b/src/main/java/org/apache/commons/math4/linear/DiagonalMatrix.java
index 56ab4b2..1b35204 100644
--- a/src/main/java/org/apache/commons/math4/linear/DiagonalMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/DiagonalMatrix.java
@@ -25,7 +25,7 @@ import org.apache.commons.math4.exception.NumberIsTooLargeException;
import org.apache.commons.math4.exception.OutOfRangeException;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathUtils;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Implementation of a diagonal matrix.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/linear/EigenDecomposition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/EigenDecomposition.java b/src/main/java/org/apache/commons/math4/linear/EigenDecomposition.java
index f9afeb7..75e9614 100644
--- a/src/main/java/org/apache/commons/math4/linear/EigenDecomposition.java
+++ b/src/main/java/org/apache/commons/math4/linear/EigenDecomposition.java
@@ -24,7 +24,7 @@ import org.apache.commons.math4.exception.MathUnsupportedOperationException;
import org.apache.commons.math4.exception.MaxCountExceededException;
import org.apache.commons.math4.exception.util.LocalizedFormats;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Calculates the eigen decomposition of a real matrix.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/linear/HessenbergTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/HessenbergTransformer.java b/src/main/java/org/apache/commons/math4/linear/HessenbergTransformer.java
index e7bf442..c10c41a 100644
--- a/src/main/java/org/apache/commons/math4/linear/HessenbergTransformer.java
+++ b/src/main/java/org/apache/commons/math4/linear/HessenbergTransformer.java
@@ -18,7 +18,7 @@
package org.apache.commons.math4.linear;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Class transforming a general real matrix to Hessenberg form.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java b/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java
index 9485b7b..cb71b37 100644
--- a/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java
+++ b/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java
@@ -37,7 +37,7 @@ import org.apache.commons.math4.fraction.Fraction;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathArrays;
import org.apache.commons.math4.util.MathUtils;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* A collection of static methods that operate on or return matrices.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/linear/SchurTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/SchurTransformer.java b/src/main/java/org/apache/commons/math4/linear/SchurTransformer.java
index 3d818b4..b836efe 100644
--- a/src/main/java/org/apache/commons/math4/linear/SchurTransformer.java
+++ b/src/main/java/org/apache/commons/math4/linear/SchurTransformer.java
@@ -20,7 +20,7 @@ package org.apache.commons.math4.linear;
import org.apache.commons.math4.exception.MaxCountExceededException;
import org.apache.commons.math4.exception.util.LocalizedFormats;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Class transforming a general real matrix to Schur form.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/linear/SingularValueDecomposition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/SingularValueDecomposition.java b/src/main/java/org/apache/commons/math4/linear/SingularValueDecomposition.java
index 65ec195..4d4116e 100644
--- a/src/main/java/org/apache/commons/math4/linear/SingularValueDecomposition.java
+++ b/src/main/java/org/apache/commons/math4/linear/SingularValueDecomposition.java
@@ -19,7 +19,7 @@ package org.apache.commons.math4.linear;
import org.apache.commons.math4.exception.NumberIsTooLargeException;
import org.apache.commons.math4.exception.util.LocalizedFormats;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Calculates the compact Singular Value Decomposition of a matrix.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java
index 61b3aa1..409e553 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java
@@ -23,7 +23,7 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.commons.math4.exception.DimensionMismatchException;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java b/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java
index 356f2b6..15cb079 100644
--- a/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java
@@ -39,7 +39,7 @@ import org.apache.commons.math4.ode.sampling.AbstractStepInterpolator;
import org.apache.commons.math4.ode.sampling.StepHandler;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.IntegerSequence;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Base class managing common boilerplate for all integrators.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/ode/events/FilterType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/events/FilterType.java b/src/main/java/org/apache/commons/math4/ode/events/FilterType.java
index 4dfaefb..023c228 100644
--- a/src/main/java/org/apache/commons/math4/ode/events/FilterType.java
+++ b/src/main/java/org/apache/commons/math4/ode/events/FilterType.java
@@ -83,7 +83,7 @@ public enum FilterType {
* <li>h = min(-s,-g,+g)</li>
* <li>h = -g</li>
* </ul>
- * where s is a tiny positive value: {@link org.apache.commons.math4.util.Precision#SAFE_MIN}.
+ * where s is a tiny positive value: {@link org.apache.commons.numbers.core.Precision#SAFE_MIN}.
* </p>
*/
@Override
@@ -261,7 +261,7 @@ public enum FilterType {
* <li>h = min(-s,-g,+g)</li>
* <li>h = -g</li>
* </ul>
- * where s is a tiny positive value: {@link org.apache.commons.math4.util.Precision#SAFE_MIN}.
+ * where s is a tiny positive value: {@link org.apache.commons.numbers.core.Precision#SAFE_MIN}.
* </p>
*/
@Override
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/ode/events/Transformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/events/Transformer.java b/src/main/java/org/apache/commons/math4/ode/events/Transformer.java
index f341f35..08e71e2 100644
--- a/src/main/java/org/apache/commons/math4/ode/events/Transformer.java
+++ b/src/main/java/org/apache/commons/math4/ode/events/Transformer.java
@@ -18,7 +18,7 @@
package org.apache.commons.math4.ode.events;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/** Transformer for {@link EventHandler#g(double, double[]) g functions}.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/ode/sampling/FieldStepNormalizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/sampling/FieldStepNormalizer.java b/src/main/java/org/apache/commons/math4/ode/sampling/FieldStepNormalizer.java
index e50e297..bee9b1b 100644
--- a/src/main/java/org/apache/commons/math4/ode/sampling/FieldStepNormalizer.java
+++ b/src/main/java/org/apache/commons/math4/ode/sampling/FieldStepNormalizer.java
@@ -21,7 +21,7 @@ import org.apache.commons.math4.RealFieldElement;
import org.apache.commons.math4.exception.MaxCountExceededException;
import org.apache.commons.math4.ode.FieldODEStateAndDerivative;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* This class wraps an object implementing {@link FieldFixedStepHandler}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizer.java b/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizer.java
index dfc34fe..edec00c 100644
--- a/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizer.java
+++ b/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizer.java
@@ -19,7 +19,7 @@ package org.apache.commons.math4.ode.sampling;
import org.apache.commons.math4.exception.MaxCountExceededException;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* This class wraps an object implementing {@link FixedStepHandler}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java b/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java
index 04b6ab9..ae8eb8c 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java
@@ -23,7 +23,7 @@ import org.apache.commons.math4.exception.TooManyIterationsException;
import org.apache.commons.math4.optim.OptimizationData;
import org.apache.commons.math4.optim.PointValuePair;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Solves a linear problem using the "Two-Phase Simplex" method.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java b/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java
index 02ee664..c435094 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java
@@ -34,7 +34,7 @@ import org.apache.commons.math4.linear.MatrixUtils;
import org.apache.commons.math4.linear.RealVector;
import org.apache.commons.math4.optim.PointValuePair;
import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* A tableau for use in the Simplex method.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/optim/univariate/BrentOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/univariate/BrentOptimizer.java b/src/main/java/org/apache/commons/math4/optim/univariate/BrentOptimizer.java
index 420a919..e1b2d9d 100644
--- a/src/main/java/org/apache/commons/math4/optim/univariate/BrentOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/univariate/BrentOptimizer.java
@@ -21,7 +21,7 @@ import org.apache.commons.math4.exception.NumberIsTooSmallException;
import org.apache.commons.math4.optim.ConvergenceChecker;
import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* For a function defined on some interval {@code (lo, hi)}, this class
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractStorelessUnivariateStatistic.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractStorelessUnivariateStatistic.java b/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractStorelessUnivariateStatistic.java
index 599188f..7d9b0d7 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractStorelessUnivariateStatistic.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractStorelessUnivariateStatistic.java
@@ -21,7 +21,7 @@ import org.apache.commons.math4.exception.NullArgumentException;
import org.apache.commons.math4.exception.util.LocalizedFormats;
import org.apache.commons.math4.util.MathArrays;
import org.apache.commons.math4.util.MathUtils;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Abstract base class for implementations of the
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/stat/descriptive/MultivariateSummaryStatistics.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/MultivariateSummaryStatistics.java b/src/main/java/org/apache/commons/math4/stat/descriptive/MultivariateSummaryStatistics.java
index 39083d0..a161fc8 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/MultivariateSummaryStatistics.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/MultivariateSummaryStatistics.java
@@ -34,7 +34,7 @@ import org.apache.commons.math4.stat.descriptive.summary.SumOfSquares;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathArrays;
import org.apache.commons.math4.util.MathUtils;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* <p>Computes summary statistics for a stream of n-tuples added using the
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalSummaryValues.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalSummaryValues.java b/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalSummaryValues.java
index a83d657..d1aa197 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalSummaryValues.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalSummaryValues.java
@@ -20,7 +20,7 @@ import java.io.Serializable;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathUtils;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Value object representing the results of a univariate statistical summary.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/stat/descriptive/SummaryStatistics.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/SummaryStatistics.java b/src/main/java/org/apache/commons/math4/stat/descriptive/SummaryStatistics.java
index b255805..91f77fb 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/SummaryStatistics.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/SummaryStatistics.java
@@ -32,7 +32,7 @@ import org.apache.commons.math4.stat.descriptive.summary.SumOfLogs;
import org.apache.commons.math4.stat.descriptive.summary.SumOfSquares;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathUtils;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* <p>
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java
index c81a4d1..7f3e54d 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java
@@ -37,7 +37,7 @@ import org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStat
import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatistic;
import org.apache.commons.math4.util.MathArrays;
import org.apache.commons.math4.util.MathUtils;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* A {@link StorelessUnivariateStatistic} estimating percentiles using the
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Percentile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Percentile.java b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Percentile.java
index a4f0eea..a85fb63 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Percentile.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Percentile.java
@@ -32,7 +32,7 @@ import org.apache.commons.math4.util.MathArrays;
import org.apache.commons.math4.util.MathUtils;
import org.apache.commons.math4.util.MedianOf3PivotingStrategy;
import org.apache.commons.math4.util.PivotingStrategyInterface;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Provides percentile computation.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/stat/regression/MillerUpdatingRegression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/regression/MillerUpdatingRegression.java b/src/main/java/org/apache/commons/math4/stat/regression/MillerUpdatingRegression.java
index 9782217..4f421d1 100644
--- a/src/main/java/org/apache/commons/math4/stat/regression/MillerUpdatingRegression.java
+++ b/src/main/java/org/apache/commons/math4/stat/regression/MillerUpdatingRegression.java
@@ -21,7 +21,7 @@ import java.util.Arrays;
import org.apache.commons.math4.exception.util.LocalizedFormats;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathArrays;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* This class is a concrete implementation of the {@link UpdatingMultipleLinearRegression} interface.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/stat/regression/SimpleRegression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/regression/SimpleRegression.java b/src/main/java/org/apache/commons/math4/stat/regression/SimpleRegression.java
index f68bc27..55b0d44 100644
--- a/src/main/java/org/apache/commons/math4/stat/regression/SimpleRegression.java
+++ b/src/main/java/org/apache/commons/math4/stat/regression/SimpleRegression.java
@@ -24,7 +24,7 @@ import org.apache.commons.math4.exception.NoDataException;
import org.apache.commons.math4.exception.OutOfRangeException;
import org.apache.commons.math4.exception.util.LocalizedFormats;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
/**
* Estimates an ordinary least squares regression model
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/util/ContinuedFraction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/ContinuedFraction.java b/src/main/java/org/apache/commons/math4/util/ContinuedFraction.java
index 56b7267..acd4b2c 100644
--- a/src/main/java/org/apache/commons/math4/util/ContinuedFraction.java
+++ b/src/main/java/org/apache/commons/math4/util/ContinuedFraction.java
@@ -16,6 +16,7 @@
*/
package org.apache.commons.math4.util;
+import org.apache.commons.numbers.core.Precision;
import org.apache.commons.math4.exception.ConvergenceException;
import org.apache.commons.math4.exception.MaxCountExceededException;
import org.apache.commons.math4.exception.util.LocalizedFormats;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/util/FastMath.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/FastMath.java b/src/main/java/org/apache/commons/math4/util/FastMath.java
index bf41840..20a9527 100644
--- a/src/main/java/org/apache/commons/math4/util/FastMath.java
+++ b/src/main/java/org/apache/commons/math4/util/FastMath.java
@@ -18,6 +18,7 @@ package org.apache.commons.math4.util;
import java.io.PrintStream;
+import org.apache.commons.numbers.core.Precision;
import org.apache.commons.math4.exception.MathArithmeticException;
import org.apache.commons.math4.exception.util.LocalizedFormats;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/util/MathArrays.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/MathArrays.java b/src/main/java/org/apache/commons/math4/util/MathArrays.java
index 9c26dbb..8d1236c 100644
--- a/src/main/java/org/apache/commons/math4/util/MathArrays.java
+++ b/src/main/java/org/apache/commons/math4/util/MathArrays.java
@@ -26,6 +26,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.TreeSet;
+import org.apache.commons.numbers.core.Precision;
import org.apache.commons.math4.Field;
import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.exception.MathArithmeticException;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/main/java/org/apache/commons/math4/util/Precision.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/Precision.java b/src/main/java/org/apache/commons/math4/util/Precision.java
deleted file mode 100644
index 91b0cb7..0000000
--- a/src/main/java/org/apache/commons/math4/util/Precision.java
+++ /dev/null
@@ -1,608 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.math4.util;
-
-import java.math.BigDecimal;
-
-import org.apache.commons.math4.exception.MathArithmeticException;
-import org.apache.commons.math4.exception.MathIllegalArgumentException;
-import org.apache.commons.math4.exception.util.LocalizedFormats;
-
-/**
- * Utilities for comparing numbers.
- *
- * @since 3.0
- */
-public class Precision {
- /**
- * <p>
- * Largest double-precision floating-point number such that
- * {@code 1 + EPSILON} is numerically equal to 1. This value is an upper
- * bound on the relative error due to rounding real numbers to double
- * precision floating-point numbers.
- * </p>
- * <p>
- * In IEEE 754 arithmetic, this is 2<sup>-53</sup>.
- * </p>
- *
- * @see <a href="http://en.wikipedia.org/wiki/Machine_epsilon">Machine epsilon</a>
- */
- public static final double EPSILON;
-
- /**
- * Safe minimum, such that {@code 1 / SAFE_MIN} does not overflow.
- * <br/>
- * In IEEE 754 arithmetic, this is also the smallest normalized
- * number 2<sup>-1022</sup>.
- */
- public static final double SAFE_MIN;
-
- /** Exponent offset in IEEE754 representation. */
- private static final long EXPONENT_OFFSET = 1023l;
-
- /** Offset to order signed double numbers lexicographically. */
- private static final long SGN_MASK = 0x8000000000000000L;
- /** Offset to order signed double numbers lexicographically. */
- private static final int SGN_MASK_FLOAT = 0x80000000;
- /** Positive zero. */
- private static final double POSITIVE_ZERO = 0d;
- /** Positive zero bits. */
- private static final long POSITIVE_ZERO_DOUBLE_BITS = Double.doubleToRawLongBits(+0.0);
- /** Negative zero bits. */
- private static final long NEGATIVE_ZERO_DOUBLE_BITS = Double.doubleToRawLongBits(-0.0);
- /** Positive zero bits. */
- private static final int POSITIVE_ZERO_FLOAT_BITS = Float.floatToRawIntBits(+0.0f);
- /** Negative zero bits. */
- private static final int NEGATIVE_ZERO_FLOAT_BITS = Float.floatToRawIntBits(-0.0f);
-
- static {
- /*
- * This was previously expressed as = 0x1.0p-53;
- * However, OpenJDK (Sparc Solaris) cannot handle such small
- * constants: MATH-721
- */
- EPSILON = Double.longBitsToDouble((EXPONENT_OFFSET - 53l) << 52);
-
- /*
- * This was previously expressed as = 0x1.0p-1022;
- * However, OpenJDK (Sparc Solaris) cannot handle such small
- * constants: MATH-721
- */
- SAFE_MIN = Double.longBitsToDouble((EXPONENT_OFFSET - 1022l) << 52);
- }
-
- /**
- * Private constructor.
- */
- private Precision() {}
-
- /**
- * Compares two numbers given some amount of allowed error.
- *
- * @param x the first number
- * @param y the second number
- * @param eps the amount of error to allow when checking for equality
- * @return <ul><li>0 if {@link #equals(double, double, double) equals(x, y, eps)}</li>
- * <li>< 0 if !{@link #equals(double, double, double) equals(x, y, eps)} && x < y</li>
- * <li>> 0 if !{@link #equals(double, double, double) equals(x, y, eps)} && x > y or
- * either argument is NaN</li></ul>
- */
- public static int compareTo(double x, double y, double eps) {
- if (equals(x, y, eps)) {
- return 0;
- } else if (x < y) {
- return -1;
- }
- return 1;
- }
-
- /**
- * Compares two numbers given some amount of allowed error.
- * Two float numbers are considered equal if there are {@code (maxUlps - 1)}
- * (or fewer) floating point numbers between them, i.e. two adjacent floating
- * point numbers are considered equal.
- * Adapted from <a
- * href="http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/">
- * Bruce Dawson</a>. Returns {@code false} if either of the arguments is NaN.
- *
- * @param x first value
- * @param y second value
- * @param maxUlps {@code (maxUlps - 1)} is the number of floating point
- * values between {@code x} and {@code y}.
- * @return <ul><li>0 if {@link #equals(double, double, int) equals(x, y, maxUlps)}</li>
- * <li>< 0 if !{@link #equals(double, double, int) equals(x, y, maxUlps)} && x < y</li>
- * <li>> 0 if !{@link #equals(double, double, int) equals(x, y, maxUlps)} && x > y
- * or either argument is NaN</li></ul>
- */
- public static int compareTo(final double x, final double y, final int maxUlps) {
- if (equals(x, y, maxUlps)) {
- return 0;
- } else if (x < y) {
- return -1;
- }
- return 1;
- }
-
- /**
- * Returns true iff they are equal as defined by
- * {@link #equals(float,float,int) equals(x, y, 1)}.
- *
- * @param x first value
- * @param y second value
- * @return {@code true} if the values are equal.
- */
- public static boolean equals(float x, float y) {
- return equals(x, y, 1);
- }
-
- /**
- * Returns true if both arguments are NaN or they are
- * equal as defined by {@link #equals(float,float) equals(x, y, 1)}.
- *
- * @param x first value
- * @param y second value
- * @return {@code true} if the values are equal or both are NaN.
- * @since 2.2
- */
- public static boolean equalsIncludingNaN(float x, float y) {
- return (x != x || y != y) ? !(x != x ^ y != y) : equals(x, y, 1);
- }
-
- /**
- * Returns true if the arguments are equal or within the range of allowed
- * error (inclusive). Returns {@code false} if either of the arguments
- * is NaN.
- *
- * @param x first value
- * @param y second value
- * @param eps the amount of absolute error to allow.
- * @return {@code true} if the values are equal or within range of each other.
- * @since 2.2
- */
- public static boolean equals(float x, float y, float eps) {
- return equals(x, y, 1) || FastMath.abs(y - x) <= eps;
- }
-
- /**
- * Returns true if the arguments are both NaN, are equal, or are within the range
- * of allowed error (inclusive).
- *
- * @param x first value
- * @param y second value
- * @param eps the amount of absolute error to allow.
- * @return {@code true} if the values are equal or within range of each other,
- * or both are NaN.
- * @since 2.2
- */
- public static boolean equalsIncludingNaN(float x, float y, float eps) {
- return equalsIncludingNaN(x, y) || (FastMath.abs(y - x) <= eps);
- }
-
- /**
- * Returns true if the arguments are equal or within the range of allowed
- * error (inclusive).
- * Two float numbers are considered equal if there are {@code (maxUlps - 1)}
- * (or fewer) floating point numbers between them, i.e. two adjacent floating
- * point numbers are considered equal.
- * Adapted from <a
- * href="http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/">
- * Bruce Dawson</a>. Returns {@code false} if either of the arguments is NaN.
- *
- * @param x first value
- * @param y second value
- * @param maxUlps {@code (maxUlps - 1)} is the number of floating point
- * values between {@code x} and {@code y}.
- * @return {@code true} if there are fewer than {@code maxUlps} floating
- * point values between {@code x} and {@code y}.
- * @since 2.2
- */
- public static boolean equals(final float x, final float y, final int maxUlps) {
-
- final int xInt = Float.floatToRawIntBits(x);
- final int yInt = Float.floatToRawIntBits(y);
-
- final boolean isEqual;
- if (((xInt ^ yInt) & SGN_MASK_FLOAT) == 0) {
- // number have same sign, there is no risk of overflow
- isEqual = FastMath.abs(xInt - yInt) <= maxUlps;
- } else {
- // number have opposite signs, take care of overflow
- final int deltaPlus;
- final int deltaMinus;
- if (xInt < yInt) {
- deltaPlus = yInt - POSITIVE_ZERO_FLOAT_BITS;
- deltaMinus = xInt - NEGATIVE_ZERO_FLOAT_BITS;
- } else {
- deltaPlus = xInt - POSITIVE_ZERO_FLOAT_BITS;
- deltaMinus = yInt - NEGATIVE_ZERO_FLOAT_BITS;
- }
-
- if (deltaPlus > maxUlps) {
- isEqual = false;
- } else {
- isEqual = deltaMinus <= (maxUlps - deltaPlus);
- }
-
- }
-
- return isEqual && !Float.isNaN(x) && !Float.isNaN(y);
-
- }
-
- /**
- * Returns true if the arguments are both NaN or if they are equal as defined
- * by {@link #equals(float,float,int) equals(x, y, maxUlps)}.
- *
- * @param x first value
- * @param y second value
- * @param maxUlps {@code (maxUlps - 1)} is the number of floating point
- * values between {@code x} and {@code y}.
- * @return {@code true} if both arguments are NaN or if there are less than
- * {@code maxUlps} floating point values between {@code x} and {@code y}.
- * @since 2.2
- */
- public static boolean equalsIncludingNaN(float x, float y, int maxUlps) {
- return (x != x || y != y) ? !(x != x ^ y != y) : equals(x, y, maxUlps);
- }
-
- /**
- * Returns true iff they are equal as defined by
- * {@link #equals(double,double,int) equals(x, y, 1)}.
- *
- * @param x first value
- * @param y second value
- * @return {@code true} if the values are equal.
- */
- public static boolean equals(double x, double y) {
- return equals(x, y, 1);
- }
-
- /**
- * Returns true if the arguments are both NaN or they are
- * equal as defined by {@link #equals(double,double) equals(x, y, 1)}.
- *
- * @param x first value
- * @param y second value
- * @return {@code true} if the values are equal or both are NaN.
- * @since 2.2
- */
- public static boolean equalsIncludingNaN(double x, double y) {
- return (x != x || y != y) ? !(x != x ^ y != y) : equals(x, y, 1);
- }
-
- /**
- * Returns {@code true} if there is no double value strictly between the
- * arguments or the difference between them is within the range of allowed
- * error (inclusive). Returns {@code false} if either of the arguments
- * is NaN.
- *
- * @param x First value.
- * @param y Second value.
- * @param eps Amount of allowed absolute error.
- * @return {@code true} if the values are two adjacent floating point
- * numbers or they are within range of each other.
- */
- public static boolean equals(double x, double y, double eps) {
- return equals(x, y, 1) || FastMath.abs(y - x) <= eps;
- }
-
- /**
- * Returns {@code true} if there is no double value strictly between the
- * arguments or the relative difference between them is less than or equal
- * to the given tolerance. Returns {@code false} if either of the arguments
- * is NaN.
- *
- * @param x First value.
- * @param y Second value.
- * @param eps Amount of allowed relative error.
- * @return {@code true} if the values are two adjacent floating point
- * numbers or they are within range of each other.
- * @since 3.1
- */
- public static boolean equalsWithRelativeTolerance(double x, double y, double eps) {
- if (equals(x, y, 1)) {
- return true;
- }
-
- final double absoluteMax = FastMath.max(FastMath.abs(x), FastMath.abs(y));
- final double relativeDifference = FastMath.abs((x - y) / absoluteMax);
-
- return relativeDifference <= eps;
- }
-
- /**
- * Returns true if the arguments are both NaN, are equal or are within the range
- * of allowed error (inclusive).
- *
- * @param x first value
- * @param y second value
- * @param eps the amount of absolute error to allow.
- * @return {@code true} if the values are equal or within range of each other,
- * or both are NaN.
- * @since 2.2
- */
- public static boolean equalsIncludingNaN(double x, double y, double eps) {
- return equalsIncludingNaN(x, y) || (FastMath.abs(y - x) <= eps);
- }
-
- /**
- * Returns true if the arguments are equal or within the range of allowed
- * error (inclusive).
- * <p>
- * Two float numbers are considered equal if there are {@code (maxUlps - 1)}
- * (or fewer) floating point numbers between them, i.e. two adjacent
- * floating point numbers are considered equal.
- * </p>
- * <p>
- * Adapted from <a
- * href="http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/">
- * Bruce Dawson</a>. Returns {@code false} if either of the arguments is NaN.
- * </p>
- *
- * @param x first value
- * @param y second value
- * @param maxUlps {@code (maxUlps - 1)} is the number of floating point
- * values between {@code x} and {@code y}.
- * @return {@code true} if there are fewer than {@code maxUlps} floating
- * point values between {@code x} and {@code y}.
- */
- public static boolean equals(final double x, final double y, final int maxUlps) {
-
- final long xInt = Double.doubleToRawLongBits(x);
- final long yInt = Double.doubleToRawLongBits(y);
-
- final boolean isEqual;
- if (((xInt ^ yInt) & SGN_MASK) == 0l) {
- // number have same sign, there is no risk of overflow
- isEqual = FastMath.abs(xInt - yInt) <= maxUlps;
- } else {
- // number have opposite signs, take care of overflow
- final long deltaPlus;
- final long deltaMinus;
- if (xInt < yInt) {
- deltaPlus = yInt - POSITIVE_ZERO_DOUBLE_BITS;
- deltaMinus = xInt - NEGATIVE_ZERO_DOUBLE_BITS;
- } else {
- deltaPlus = xInt - POSITIVE_ZERO_DOUBLE_BITS;
- deltaMinus = yInt - NEGATIVE_ZERO_DOUBLE_BITS;
- }
-
- if (deltaPlus > maxUlps) {
- isEqual = false;
- } else {
- isEqual = deltaMinus <= (maxUlps - deltaPlus);
- }
-
- }
-
- return isEqual && !Double.isNaN(x) && !Double.isNaN(y);
-
- }
-
- /**
- * Returns true if both arguments are NaN or if they are equal as defined
- * by {@link #equals(double,double,int) equals(x, y, maxUlps)}.
- *
- * @param x first value
- * @param y second value
- * @param maxUlps {@code (maxUlps - 1)} is the number of floating point
- * values between {@code x} and {@code y}.
- * @return {@code true} if both arguments are NaN or if there are less than
- * {@code maxUlps} floating point values between {@code x} and {@code y}.
- * @since 2.2
- */
- public static boolean equalsIncludingNaN(double x, double y, int maxUlps) {
- return (x != x || y != y) ? !(x != x ^ y != y) : equals(x, y, maxUlps);
- }
-
- /**
- * Rounds the given value to the specified number of decimal places.
- * The value is rounded using the {@link BigDecimal#ROUND_HALF_UP} method.
- *
- * @param x Value to round.
- * @param scale Number of digits to the right of the decimal point.
- * @return the rounded value.
- * @since 1.1 (previously in {@code MathUtils}, moved as of version 3.0)
- */
- public static double round(double x, int scale) {
- return round(x, scale, BigDecimal.ROUND_HALF_UP);
- }
-
- /**
- * Rounds the given value to the specified number of decimal places.
- * The value is rounded using the given method which is any method defined
- * in {@link BigDecimal}.
- * If {@code x} is infinite or {@code NaN}, then the value of {@code x} is
- * returned unchanged, regardless of the other parameters.
- *
- * @param x Value to round.
- * @param scale Number of digits to the right of the decimal point.
- * @param roundingMethod Rounding method as defined in {@link BigDecimal}.
- * @return the rounded value.
- * @throws ArithmeticException if {@code roundingMethod == ROUND_UNNECESSARY}
- * and the specified scaling operation would require rounding.
- * @throws IllegalArgumentException if {@code roundingMethod} does not
- * represent a valid rounding mode.
- * @since 1.1 (previously in {@code MathUtils}, moved as of version 3.0)
- */
- public static double round(double x, int scale, int roundingMethod) {
- try {
- final double rounded = (new BigDecimal(Double.toString(x))
- .setScale(scale, roundingMethod))
- .doubleValue();
- // MATH-1089: negative values rounded to zero should result in negative zero
- return rounded == POSITIVE_ZERO ? POSITIVE_ZERO * x : rounded;
- } catch (NumberFormatException ex) {
- if (Double.isInfinite(x)) {
- return x;
- } else {
- return Double.NaN;
- }
- }
- }
-
- /**
- * Rounds the given value to the specified number of decimal places.
- * The value is rounded using the {@link BigDecimal#ROUND_HALF_UP} method.
- *
- * @param x Value to round.
- * @param scale Number of digits to the right of the decimal point.
- * @return the rounded value.
- * @since 1.1 (previously in {@code MathUtils}, moved as of version 3.0)
- */
- public static float round(float x, int scale) {
- return round(x, scale, BigDecimal.ROUND_HALF_UP);
- }
-
- /**
- * Rounds the given value to the specified number of decimal places.
- * The value is rounded using the given method which is any method defined
- * in {@link BigDecimal}.
- *
- * @param x Value to round.
- * @param scale Number of digits to the right of the decimal point.
- * @param roundingMethod Rounding method as defined in {@link BigDecimal}.
- * @return the rounded value.
- * @since 1.1 (previously in {@code MathUtils}, moved as of version 3.0)
- * @throws MathArithmeticException if an exact operation is required but result is not exact
- * @throws MathIllegalArgumentException if {@code roundingMethod} is not a valid rounding method.
- */
- public static float round(float x, int scale, int roundingMethod)
- throws MathArithmeticException, MathIllegalArgumentException {
- final float sign = FastMath.copySign(1f, x);
- final float factor = (float) FastMath.pow(10.0f, scale) * sign;
- return (float) roundUnscaled(x * factor, sign, roundingMethod) / factor;
- }
-
- /**
- * Rounds the given non-negative value to the "nearest" integer. Nearest is
- * determined by the rounding method specified. Rounding methods are defined
- * in {@link BigDecimal}.
- *
- * @param unscaled Value to round.
- * @param sign Sign of the original, scaled value.
- * @param roundingMethod Rounding method, as defined in {@link BigDecimal}.
- * @return the rounded value.
- * @throws MathArithmeticException if an exact operation is required but result is not exact
- * @throws MathIllegalArgumentException if {@code roundingMethod} is not a valid rounding method.
- * @since 1.1 (previously in {@code MathUtils}, moved as of version 3.0)
- */
- private static double roundUnscaled(double unscaled,
- double sign,
- int roundingMethod)
- throws MathArithmeticException, MathIllegalArgumentException {
- switch (roundingMethod) {
- case BigDecimal.ROUND_CEILING :
- if (sign == -1) {
- unscaled = FastMath.floor(FastMath.nextAfter(unscaled, Double.NEGATIVE_INFINITY));
- } else {
- unscaled = FastMath.ceil(FastMath.nextAfter(unscaled, Double.POSITIVE_INFINITY));
- }
- break;
- case BigDecimal.ROUND_DOWN :
- unscaled = FastMath.floor(FastMath.nextAfter(unscaled, Double.NEGATIVE_INFINITY));
- break;
- case BigDecimal.ROUND_FLOOR :
- if (sign == -1) {
- unscaled = FastMath.ceil(FastMath.nextAfter(unscaled, Double.POSITIVE_INFINITY));
- } else {
- unscaled = FastMath.floor(FastMath.nextAfter(unscaled, Double.NEGATIVE_INFINITY));
- }
- break;
- case BigDecimal.ROUND_HALF_DOWN : {
- unscaled = FastMath.nextAfter(unscaled, Double.NEGATIVE_INFINITY);
- double fraction = unscaled - FastMath.floor(unscaled);
- if (fraction > 0.5) {
- unscaled = FastMath.ceil(unscaled);
- } else {
- unscaled = FastMath.floor(unscaled);
- }
- break;
- }
- case BigDecimal.ROUND_HALF_EVEN : {
- double fraction = unscaled - FastMath.floor(unscaled);
- if (fraction > 0.5) {
- unscaled = FastMath.ceil(unscaled);
- } else if (fraction < 0.5) {
- unscaled = FastMath.floor(unscaled);
- } else {
- // The following equality test is intentional and needed for rounding purposes
- if (FastMath.floor(unscaled) / 2.0 == FastMath.floor(FastMath.floor(unscaled) / 2.0)) { // even
- unscaled = FastMath.floor(unscaled);
- } else { // odd
- unscaled = FastMath.ceil(unscaled);
- }
- }
- break;
- }
- case BigDecimal.ROUND_HALF_UP : {
- unscaled = FastMath.nextAfter(unscaled, Double.POSITIVE_INFINITY);
- double fraction = unscaled - FastMath.floor(unscaled);
- if (fraction >= 0.5) {
- unscaled = FastMath.ceil(unscaled);
- } else {
- unscaled = FastMath.floor(unscaled);
- }
- break;
- }
- case BigDecimal.ROUND_UNNECESSARY :
- if (unscaled != FastMath.floor(unscaled)) {
- throw new MathArithmeticException();
- }
- break;
- case BigDecimal.ROUND_UP :
- // do not round if the discarded fraction is equal to zero
- if (unscaled != FastMath.floor(unscaled)) {
- unscaled = FastMath.ceil(FastMath.nextAfter(unscaled, Double.POSITIVE_INFINITY));
- }
- break;
- default :
- throw new MathIllegalArgumentException(LocalizedFormats.INVALID_ROUNDING_METHOD,
- roundingMethod,
- "ROUND_CEILING", BigDecimal.ROUND_CEILING,
- "ROUND_DOWN", BigDecimal.ROUND_DOWN,
- "ROUND_FLOOR", BigDecimal.ROUND_FLOOR,
- "ROUND_HALF_DOWN", BigDecimal.ROUND_HALF_DOWN,
- "ROUND_HALF_EVEN", BigDecimal.ROUND_HALF_EVEN,
- "ROUND_HALF_UP", BigDecimal.ROUND_HALF_UP,
- "ROUND_UNNECESSARY", BigDecimal.ROUND_UNNECESSARY,
- "ROUND_UP", BigDecimal.ROUND_UP);
- }
- return unscaled;
- }
-
-
- /**
- * Computes a number {@code delta} close to {@code originalDelta} with
- * the property that <pre><code>
- * x + delta - x
- * </code></pre>
- * is exactly machine-representable.
- * This is useful when computing numerical derivatives, in order to reduce
- * roundoff errors.
- *
- * @param x Value.
- * @param originalDelta Offset value.
- * @return a number {@code delta} so that {@code x + delta} and {@code x}
- * differ by a representable floating number.
- */
- public static double representableDelta(double x,
- double originalDelta) {
- return x + originalDelta - x;
- }
-}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/TestUtils.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/TestUtils.java b/src/test/java/org/apache/commons/math4/TestUtils.java
index bfa4644..992e0d8 100644
--- a/src/test/java/org/apache/commons/math4/TestUtils.java
+++ b/src/test/java/org/apache/commons/math4/TestUtils.java
@@ -32,7 +32,7 @@ import org.apache.commons.math4.linear.RealMatrix;
import org.apache.commons.math4.linear.RealVector;
import org.apache.commons.math4.stat.inference.ChiSquareTest;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
/**
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java b/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
index 1e82465..e926cc3 100644
--- a/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
@@ -31,7 +31,7 @@ import org.apache.commons.rng.simple.RandomSource;
import org.apache.commons.math4.util.ArithmeticUtils;
import org.apache.commons.math4.util.CombinatoricsUtils;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/analysis/function/HarmonicOscillatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/function/HarmonicOscillatorTest.java b/src/test/java/org/apache/commons/math4/analysis/function/HarmonicOscillatorTest.java
index c195d20..6b75e55 100644
--- a/src/test/java/org/apache/commons/math4/analysis/function/HarmonicOscillatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/function/HarmonicOscillatorTest.java
@@ -23,7 +23,7 @@ import org.apache.commons.math4.analysis.function.HarmonicOscillator;
import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.exception.NullArgumentException;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolatorTest.java
index 85a3e09..0d6ccf3 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolatorTest.java
@@ -29,7 +29,7 @@ import org.apache.commons.math4.exception.NumberIsTooSmallException;
import org.apache.commons.rng.UniformRandomProvider;
import org.apache.commons.rng.simple.RandomSource;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
index dc53e40..57d5b24 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
@@ -25,7 +25,7 @@ import org.apache.commons.math4.exception.OutOfRangeException;
import org.apache.commons.rng.UniformRandomProvider;
import org.apache.commons.rng.simple.RandomSource;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunctionTest.java
index fc38867..6ee205c 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunctionTest.java
@@ -26,7 +26,7 @@ import org.apache.commons.math4.exception.NullArgumentException;
import org.apache.commons.rng.UniformRandomProvider;
import org.apache.commons.rng.simple.RandomSource;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunctionTest.java
index 79777fa..a28a6fc 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunctionTest.java
@@ -24,7 +24,7 @@ import org.apache.commons.math4.exception.MathIllegalArgumentException;
import org.apache.commons.rng.UniformRandomProvider;
import org.apache.commons.rng.simple.RandomSource;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtilsTest.java b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtilsTest.java
index 45eba78..e9d2d09 100644
--- a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtilsTest.java
@@ -20,7 +20,7 @@ import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.integration.IterativeLegendreGaussIntegrator;
import org.apache.commons.math4.util.CombinatoricsUtils;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/dfp/DfpTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/dfp/DfpTest.java b/src/test/java/org/apache/commons/math4/dfp/DfpTest.java
index eeeae4b..01bd54d 100644
--- a/src/test/java/org/apache/commons/math4/dfp/DfpTest.java
+++ b/src/test/java/org/apache/commons/math4/dfp/DfpTest.java
@@ -21,7 +21,7 @@ import org.apache.commons.math4.ExtendedFieldElementAbstractTest;
import org.apache.commons.math4.dfp.Dfp;
import org.apache.commons.math4.dfp.DfpField;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/distribution/ExponentialDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/ExponentialDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/ExponentialDistributionTest.java
index 465bfb5..00fa614 100644
--- a/src/test/java/org/apache/commons/math4/distribution/ExponentialDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/ExponentialDistributionTest.java
@@ -19,7 +19,7 @@ package org.apache.commons.math4.distribution;
import org.apache.commons.math4.distribution.ExponentialDistribution;
import org.apache.commons.math4.exception.NotStrictlyPositiveException;
import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/distribution/GumbelDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/GumbelDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/GumbelDistributionTest.java
index 7a06926..d041e26 100644
--- a/src/test/java/org/apache/commons/math4/distribution/GumbelDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/GumbelDistributionTest.java
@@ -17,7 +17,7 @@
package org.apache.commons.math4.distribution;
import org.apache.commons.math4.distribution.GumbelDistribution;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/distribution/HypergeometricDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/HypergeometricDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/HypergeometricDistributionTest.java
index 31f04ba..85b73f4 100644
--- a/src/test/java/org/apache/commons/math4/distribution/HypergeometricDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/HypergeometricDistributionTest.java
@@ -23,7 +23,7 @@ import org.apache.commons.math4.distribution.IntegerDistribution;
import org.apache.commons.math4.exception.NotPositiveException;
import org.apache.commons.math4.exception.NotStrictlyPositiveException;
import org.apache.commons.math4.exception.NumberIsTooLargeException;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.apache.commons.rng.simple.RandomSource;
import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e082e0c4/src/test/java/org/apache/commons/math4/distribution/LaplaceDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/LaplaceDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/LaplaceDistributionTest.java
index 55ea7df..099ce72 100644
--- a/src/test/java/org/apache/commons/math4/distribution/LaplaceDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/LaplaceDistributionTest.java
@@ -17,7 +17,7 @@
package org.apache.commons.math4.distribution;
import org.apache.commons.math4.distribution.LaplaceDistribution;
-import org.apache.commons.math4.util.Precision;
+import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;