From 7257d3e9619603410ad62c52b0c120d327ada8b4 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 18 Sep 2026 22:15:47 +0000 Subject: [PATCH] test: migrate `stats/incr/prod` to ULP-based assertions Migrate the relative tolerance assertions in `stats/incr/prod` tests to ULP-based assertions using `@stdlib/assert/is-almost-same-value`. Both converted assertions were tightened to a measured minimum of 1 ULP. Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01FsMJkqn6MeCqGA4HCRiJEe --- .../@stdlib/stats/incr/prod/test/test.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/incr/prod/test/test.js b/lib/node_modules/@stdlib/stats/incr/prod/test/test.js index 1b0f6725ce82..e5cf3532c1b7 100644 --- a/lib/node_modules/@stdlib/stats/incr/prod/test/test.js +++ b/lib/node_modules/@stdlib/stats/incr/prod/test/test.js @@ -24,12 +24,11 @@ var tape = require( 'tape' ); var zeros = require( '@stdlib/array/zeros' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPSILON = require( '@stdlib/constants/float64/eps' ); var normal = require( '@stdlib/random/base/normal' ); var randu = require( '@stdlib/random/base/randu' ); var ldexp = require( '@stdlib/math/base/special/ldexp' ); -var abs = require( '@stdlib/math/base/special/abs' ); var isnan = require( '@stdlib/assert/is-nan' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var isEven = require( '@stdlib/math/base/assert/is-even' ); var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); @@ -131,8 +130,6 @@ tape( 'the accumulator function can return a result which overflows', function t tape( 'overflow may be transient', function test( t ) { var expected; - var delta; - var tol; var acc; var x; var y; @@ -150,10 +147,7 @@ tape( 'overflow may be transient', function test( t ) { acc( y ); acc( z ); - delta = abs( expected - acc() ); - tol = EPSILON * abs( expected ); - - t.strictEqual( delta <= tol, true, 'within tolerance. Expected: '+expected+'. Actual: '+acc()+'. Delta: '+delta+'. Tol: '+tol+'.' ); + t.strictEqual( isAlmostSameValue( acc(), expected, 1 ), true, 'returns expected value' ); t.end(); }); @@ -169,8 +163,6 @@ tape( 'the accumulator function can return a result which underflows', function tape( 'underflow may be transient', function test( t ) { var expected; - var delta; - var tol; var acc; var x; var y; @@ -191,10 +183,7 @@ tape( 'underflow may be transient', function test( t ) { acc( z ); - delta = abs( acc() - expected ); - tol = EPSILON * abs( expected ); - - t.strictEqual( delta <= tol, true, 'within tolerance. Expected: '+expected+'. Actual: '+acc()+'. Delta: '+delta+'. Tol: '+tol+'.' ); + t.strictEqual( isAlmostSameValue( acc(), expected, 1 ), true, 'returns expected value' ); t.end(); });