From 550336382acc69151fd364c2e5c5a8e75d00571d Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 23 Aug 2026 02:15:56 +0000 Subject: [PATCH] test: migrate `stats/base/dists/chisquare/median` to ULP-based assertions Replace the relative tolerance assertions in the fixture loop with `@stdlib/assert/is-almost-same-value` ULP difference assertions. The ULP bound was tightened to the measured minimum which passes over the full fixture set (39 ULP; 38 ULP fails). Resolves a part of #11352. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01MAEBRF5LEKrKy5oLKGLSHB --- .../stats/base/dists/chisquare/median/test/test.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/chisquare/median/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/chisquare/median/test/test.js index da3146a975b3..9af3fc8ca1c3 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chisquare/median/test/test.js +++ b/lib/node_modules/@stdlib/stats/base/dists/chisquare/median/test/test.js @@ -21,10 +21,9 @@ // MODULES // var tape = require( 'tape' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var abs = require( '@stdlib/math/base/special/abs' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var median = require( './../lib' ); @@ -61,8 +60,6 @@ tape( 'if provided a degrees of freedom `k` that is not a nonnegative number, th tape( 'the function returns the median of chi-squared distribution', function test( t ) { var expected; - var delta; - var tol; var k; var i; var y; @@ -71,13 +68,7 @@ tape( 'the function returns the median of chi-squared distribution', function te k = data.k; for ( i = 0; i < expected.length; i++ ) { y = median( k[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'k: '+k[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 25.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. k: '+k[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 39 ), true, 'returns expected value' ); } t.end(); });