This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-statistics.git
commit e257b090f624e9f2d847a54d2cd0274ff7166572 Author: Alex Herbert <[email protected]> AuthorDate: Thu Oct 21 17:42:47 2021 +0100 Add constant for the smallest relative error --- .../statistics/distribution/BaseDistributionTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/BaseDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/BaseDistributionTest.java index 87d3cc2..fcdbee3 100644 --- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/BaseDistributionTest.java +++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/BaseDistributionTest.java @@ -73,6 +73,21 @@ abstract class BaseDistributionTest<T, D extends DistributionTestData> { protected final List<D> data = new ArrayList<>(); /** + * The smallest value (epsilon) for the relative error of a {@code double}. + * Set the relative error to an integer factor of this to test very + * small differences as errors of units in the last place (ULP). + * Assumes the relative error is: + * <pre> + * |x - y| + * ------------- + * max(|x|, |y|) + * </pre> + * + * <p>Value is 2.220446049250313E-16. + */ + static final double RELATIVE_EPS = Math.ulp(1.0); + + /** * Setup the test using data loaded from resource files. * Resource files are assumed to be named sequentially from 1: * <pre>
