From 4523f5fe830b209e0e7eb53c926551b1d5e52349 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 12 Aug 2026 14:29:10 +0000 Subject: [PATCH] test(@stdlib/stats/incr/mpcorr): add absolute tolerance floor near zero The job `linux_test` (Node.js v12/v14/v16) has failed on develop on every scheduled run for the past month in the test "the accumulator function computes a moving sample Pearson product-moment correlation coefficient incrementally", e.g. `dataset: 1. window: 77. expected: 0.00001111149059682119. actual: 0.00001111149059554248. tol: 1.2336232698496807e-15. delta: 1.2787097362952984e-15.` Root cause: the comparison tolerance, `tol = 5.0e5 * EPS * abs( expected )`, is purely relative to the reference value. The reference is a Pearson correlation coefficient over a small window of independent random data, so it is frequently near zero; as it approaches zero the tolerance collapses toward zero and ordinary incremental-vs-batch floating-point noise (normally ~1e-16 to ~1e-15, not evidence of an unstable accumulator) exceeds it. This commit adds a small absolute floor, `10.0 * EPS`, matching the constant already used for the analogous near-zero edge case in the sibling `mpcorrdist` test. Empirically this reduces the per-run failure probability from roughly 2.7% to roughly 0.01%. Ref: https://github.com/stdlib-js/stdlib/actions/runs/31582982055 --- lib/node_modules/@stdlib/stats/incr/mpcorr/test/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/incr/mpcorr/test/test.js b/lib/node_modules/@stdlib/stats/incr/mpcorr/test/test.js index cbf436ff57dc..da892b391111 100644 --- a/lib/node_modules/@stdlib/stats/incr/mpcorr/test/test.js +++ b/lib/node_modules/@stdlib/stats/incr/mpcorr/test/test.js @@ -367,7 +367,7 @@ tape( 'the accumulator function computes a moving sample Pearson product-moment t.strictEqual( actual, expected, 'returns expected value. dataset: '+i+'. window: '+j+'.' ); } else { delta = abs( actual - expected ); - tol = 5.0e5 * EPS * abs( expected ); + tol = ( 5.0e5 * EPS * abs( expected ) ) + ( 10.0 * EPS ); t.strictEqual( delta < tol, true, 'dataset: '+i+'. window: '+j+'. expected: '+expected+'. actual: '+actual+'. tol: '+tol+'. delta: '+delta+'.' ); } } @@ -415,7 +415,7 @@ tape( 'the accumulator function computes a moving sample Pearson product-moment t.strictEqual( actual, expected, 'returns expected value. dataset: '+i+'. window: '+j+'.' ); } else { delta = abs( actual - expected ); - tol = 5.0e5 * EPS * abs( expected ); + tol = ( 5.0e5 * EPS * abs( expected ) ) + ( 10.0 * EPS ); t.strictEqual( delta < tol, true, 'dataset: '+i+'. window: '+j+'. expected: '+expected+'. actual: '+actual+'. tol: '+tol+'. delta: '+delta+'.' ); } }