diff --git a/lib/node_modules/@stdlib/stats/incr/mpcorrdist/test/test.js b/lib/node_modules/@stdlib/stats/incr/mpcorrdist/test/test.js index 73700752d7eb..9deef0542058 100644 --- a/lib/node_modules/@stdlib/stats/incr/mpcorrdist/test/test.js +++ b/lib/node_modules/@stdlib/stats/incr/mpcorrdist/test/test.js @@ -380,8 +380,8 @@ tape( 'the accumulator function computes a moving sample Pearson product-moment actual = 0.0; // NOTE: this addresses occasional negative values due to accumulated floating-point error. Based on observation, typically `|actual| ≅ |expected|`, but `actual < 0` and `expected > 0`, suggesting that a sign got "flipped" along the way due to, e.g., operations which theoretically should compute to the same value, but do not due to floating-point error. } delta = abs( actual - expected ); - if ( expected === 0.0 || actual === 0.0 ) { - tol = 10.0 * EPS; + if ( abs( expected ) < 1.0 ) { + tol = 1.0e6 * EPS; } else { tol = 1.0e6 * EPS * abs( expected ); } @@ -434,7 +434,11 @@ 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 = 1.0e6 * EPS * abs( expected ); + if ( abs( expected ) < 1.0 ) { + tol = 1.0e6 * EPS; + } else { + tol = 1.0e6 * EPS * abs( expected ); + } t.strictEqual( delta <= tol, true, 'dataset: '+i+'. window: '+j+'. expected: '+expected+'. actual: '+actual+'. tol: '+tol+'. delta: '+delta+'.' ); } }