From 338e4d92172e5405f360d90bd7948d27a026b4f0 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 20 Sep 2026 02:14:54 +0000 Subject: [PATCH] test: migrate `stats/base/dists/gumbel/entropy` to ULP-based assertions Replaces the computed relative tolerance assertions in the fixture loops with `isAlmostSameValue` ULP comparisons. The ULP bound was tightened to the measured minimum of 1 ULP over the full Julia fixture set. Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_013v2kAY2MhA6iFWBEBPWRUk --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: skipped - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../stats/base/dists/gumbel/entropy/test/test.js | 13 ++----------- .../base/dists/gumbel/entropy/test/test.native.js | 15 +++------------ 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/gumbel/entropy/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/gumbel/entropy/test/test.js index 61e5d563228f..7292c0b92288 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/gumbel/entropy/test/test.js +++ b/lib/node_modules/@stdlib/stats/base/dists/gumbel/entropy/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 entropy = require( './../lib' ); @@ -76,9 +75,7 @@ tape( 'if provided a nonpositive `beta`, the function returns `NaN`', function t tape( 'the function returns the differential entropy of a Gumbel distribution', function test( t ) { var expected; - var delta; var beta; - var tol; var mu; var y; var i; @@ -89,13 +86,7 @@ tape( 'the function returns the differential entropy of a Gumbel distribution', for ( i = 0; i < mu.length; i++ ) { y = entropy( mu[i], beta[i] ); if ( expected[i] !== null ) { - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'mu:'+mu[i]+', beta: '+beta[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 2.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. mu: '+mu[i]+'. beta: '+beta[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } } t.end(); diff --git a/lib/node_modules/@stdlib/stats/base/dists/gumbel/entropy/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/gumbel/entropy/test/test.native.js index 794173a44528..20466b347e0b 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/gumbel/entropy/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/gumbel/entropy/test/test.native.js @@ -22,12 +22,11 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var tryRequire = require( '@stdlib/utils/try-require' ); 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' ); // FIXTURES // @@ -88,9 +87,7 @@ tape( 'if provided a nonpositive `beta`, the function returns `NaN`', opts, func tape( 'the function returns the differential entropy of a Gumbel distribution', opts, function test( t ) { var expected; - var delta; var beta; - var tol; var mu; var y; var i; @@ -100,14 +97,8 @@ tape( 'the function returns the differential entropy of a Gumbel distribution', beta = data.beta; for ( i = 0; i < mu.length; i++ ) { y = entropy( mu[i], beta[i] ); - if ( expected[i] !== null) { - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'mu:'+mu[i]+', beta: '+beta[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 2.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. mu: '+mu[i]+'. beta: '+beta[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + if ( expected[i] !== null ) { + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } } t.end();