From 86f06113c4f74280c4e2471f0b94eedc761de4ac Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 23 Sep 2026 18:26:56 +0000 Subject: [PATCH] test: migrate `stats/incr/nanmrmse` to ULP-based assertions Migrate the package tests from relative tolerance (EPS-scaled) assertions to ULP-based assertions using `@stdlib/assert/is-almost-same-value`. The measured minimum ULP bound is zero, matching the sibling packages `stats/incr/mrmse` and `stats/incr/rmse`. Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01GV42GrG2HRgkWaQR5rS8tz --- .../@stdlib/stats/incr/nanmrmse/test/test.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/incr/nanmrmse/test/test.js b/lib/node_modules/@stdlib/stats/incr/nanmrmse/test/test.js index e27b7ece3d82..6eae52d22b25 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmrmse/test/test.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmrmse/test/test.js @@ -21,9 +21,8 @@ // MODULES // var tape = require( 'tape' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var sqrt = require( '@stdlib/math/base/special/sqrt' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var incrnanmrmse = require( './../lib' ); @@ -73,10 +72,8 @@ tape( 'the function returns an accumulator function', function test( t ) { tape( 'the accumulator function computes a moving root mean squared error incrementally, ignoring `NaN` values', function test( t ) { var expected; var actual; - var delta; var data; var acc; - var tol; var N; var i; @@ -105,14 +102,8 @@ tape( 'the accumulator function computes a moving root mean squared error increm sqrt( 154.0/3.0 ) ]; for ( i = 0; i < N; i++ ) { - actual = acc( data[i][0], data[i][1] ); - if ( actual === expected[i] ) { - t.strictEqual( actual, expected[i], 'returns expected value' ); - } else { - delta = abs( expected[i] - actual ); - tol = 1.0 * EPS * abs( expected[i] ); - t.strictEqual( delta <= tol, true, 'within tolerance. Actual: '+actual+'. Expected: '+expected[i]+'. Delta: '+delta+'. Tol: '+tol+'.' ); - } + actual = acc( data[ i ][ 0 ], data[ i ][ 1 ] ); + t.strictEqual( isAlmostSameValue( actual, expected[ i ], 0 ), true, 'returns expected value' ); } t.end(); });