From 2f4df9eeb6c3bb6ca64684bd71789b5199066491 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 27 Sep 2026 18:31:32 +0000 Subject: [PATCH] test: migrate `stats/base/dists/logistic/mode` to ULP-based assertions Replace the computed relative-tolerance comparison in the fixture loop with `isAlmostSameValue` in order to assert accuracy in terms of ULP difference. All 100 fixture values are returned exactly, and thus the tightest bound is zero ULP. Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_014sB2jTL6Yirx4GvtNhCEHj --- .../stats/base/dists/logistic/mode/test/test.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/logistic/mode/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/logistic/mode/test/test.js index dabaaa24f4c2..af5f2b4257a2 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/logistic/mode/test/test.js +++ b/lib/node_modules/@stdlib/stats/base/dists/logistic/mode/test/test.js @@ -21,11 +21,10 @@ // MODULES // var tape = require( 'tape' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var abs = require( '@stdlib/math/base/special/abs' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var mode = require( './../lib' ); @@ -76,8 +75,6 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', function test tape( 'the function returns the mode of a logistic distribution', function test( t ) { var expected; - var delta; - var tol; var mu; var s; var y; @@ -89,13 +86,7 @@ tape( 'the function returns the mode of a logistic distribution', function test( for ( i = 0; i < mu.length; i++ ) { y = mode( mu[i], s[i] ); if ( expected[i] !== null ) { - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'mu:'+mu[i]+', s: '+s[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. mu: '+mu[i]+'. s: '+s[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' ); } } t.end();