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


The following commit(s) were added to refs/heads/master by this push:
     new 2167f25  Refine test tolerances for the Mean
2167f25 is described below

commit 2167f25f86b1769277e37be071cdc68c97c3a74d
Author: aherbert <[email protected]>
AuthorDate: Thu Jan 4 17:41:29 2024 +0000

    Refine test tolerances for the Mean
---
 .../org/apache/commons/statistics/descriptive/MeanTest.java  | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/MeanTest.java
 
b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/MeanTest.java
index 93bafe1..89edfc3 100644
--- 
a/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/MeanTest.java
+++ 
b/commons-statistics-descriptive/src/test/java/org/apache/commons/statistics/descriptive/MeanTest.java
@@ -75,7 +75,7 @@ final class MeanTest extends BaseDoubleStatisticTest<Mean> {
 
     @Override
     protected DoubleTolerance getToleranceAcceptAndCombine() {
-        return DoubleTolerances.ulps(5);
+        return DoubleTolerances.ulps(8);
     }
 
     @Override
@@ -96,7 +96,15 @@ final class MeanTest extends BaseDoubleStatisticTest<Mean> {
         Arrays.fill(a, a.length / 2, a.length, 0.1);
         // Actual mean is 1.1 / 2 = 0.55; numpy computes 0.5500000000000007
         // Use the actual mean on this difficult case.
-        builder.accept(addReference(0.55, createRelTolerance(1e-13), a));
+        // This case is difficult for the accept method or any combine when 
the data is
+        // not randomised. The dual-pass array method is good on a single 
array, but not
+        // the array and combine.
+        builder.accept(addReference(0.55,
+            createRelTolerance(1e-13), // accept
+            createRelTolerance(5e-16), // array
+            createRelTolerance(1e-13), // accept and combine
+            createRelTolerance(3e-13), // array and combine
+            a));
         // R v4.3.1: mean(x)
         builder.accept(addReference(5.5, DoubleTolerances.ulps(1), 1, 2, 3, 4, 
5, 6, 7, 8, 9, 10));
         builder.accept(addReference(8.75, DoubleTolerances.ulps(2), 0, 1, 2, 
3, 4, 5, 6, 7, 8, 9, 10, 50));

Reply via email to