You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2021/12/24 15:10:23 UTC

[commons-statistics] 04/04: Increase Exponential PDF test tolerance

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 c4b0a747adaf13ef152bcfc018fbeddb440fa2dc
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Fri Dec 24 15:08:39 2021 +0000

    Increase Exponential PDF test tolerance
    
    The Math.exp function is platform dependent and has lower accuracy than
    1 ULP on the given test data depending on the JDK and OS.
---
 .../commons/statistics/distribution/ExponentialDistributionTest.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ExponentialDistributionTest.java b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ExponentialDistributionTest.java
index a9b8a7e..c52b350 100644
--- a/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ExponentialDistributionTest.java
+++ b/commons-statistics-distribution/src/test/java/org/apache/commons/statistics/distribution/ExponentialDistributionTest.java
@@ -87,7 +87,7 @@ class ExponentialDistributionTest extends BaseContinuousDistributionTest {
         final double a = ExponentialDistribution.of(mean).density(x);
         // Require high precision.
         // This has max error of 3 ulp if using exp(logDensity(x)).
-        Assertions.assertEquals(e, a, Math.ulp(e),
+        Assertions.assertEquals(e, a, 2 * Math.ulp(e),
             () -> "ULP error: " + expected.subtract(new BigDecimal(a)).doubleValue() / Math.ulp(e));
     }
 }