From e9e7a8dcbe47a996cddf0e2e6c82309cd7b764a5 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 10 Aug 2026 06:38:53 +0000 Subject: [PATCH] test: migrate `stats/base/dists/pareto-type1/kurtosis` to ULP-based assertions Replaces the relative-tolerance comparisons in `test.js` and `test.native.js` with `isAlmostSameValue` ULP-difference assertions. Both the JavaScript and C implementations are bit-exact against the Julia fixtures over all 1000 cases, so the ULP bound is tightened to 0 (previously 1.0*EPS and 2.0*EPS relative tolerances, respectively). Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01VRnhaYbnH5rDnzzpfGqT3o --- .../base/dists/pareto-type1/kurtosis/test/test.js | 13 ++----------- .../dists/pareto-type1/kurtosis/test/test.native.js | 13 ++----------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/pareto-type1/kurtosis/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/pareto-type1/kurtosis/test/test.js index 92bc49e2d60e..4b7e8ce8464b 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/pareto-type1/kurtosis/test/test.js +++ b/lib/node_modules/@stdlib/stats/base/dists/pareto-type1/kurtosis/test/test.js @@ -21,11 +21,10 @@ // MODULES // var tape = require( 'tape' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var kurtosis = require( './../lib' ); @@ -105,10 +104,8 @@ tape( 'if provided `beta <= 0`, the function returns `NaN`', function test( t ) tape( 'the function returns the excess kurtosis of a Pareto (Type I) distribution', function test( t ) { var expected; - var delta; var alpha; var beta; - var tol; var i; var y; @@ -117,13 +114,7 @@ tape( 'the function returns the excess kurtosis of a Pareto (Type I) distributio beta = data.beta; for ( i = 0; i < expected.length; i++ ) { y = kurtosis( alpha[i], beta[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'alpha: '+alpha[i]+', beta: '+beta[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. alpha: '+alpha[i]+'. beta: '+beta[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/pareto-type1/kurtosis/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/pareto-type1/kurtosis/test/test.native.js index b755295cfadc..538afd916de2 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/pareto-type1/kurtosis/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/pareto-type1/kurtosis/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 abs = require( '@stdlib/math/base/special/abs' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); // VARIABLES // @@ -114,10 +113,8 @@ tape( 'if provided `beta <= 0`, the function returns `NaN`', opts, function test tape( 'the function returns the excess kurtosis of a Pareto (Type I) distribution', opts, function test( t ) { var expected; - var delta; var alpha; var beta; - var tol; var i; var y; @@ -126,13 +123,7 @@ tape( 'the function returns the excess kurtosis of a Pareto (Type I) distributio beta = data.beta; for ( i = 0; i < expected.length; i++ ) { y = kurtosis( alpha[i], beta[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'alpha: '+alpha[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. alpha: '+alpha[i]+'. beta: '+beta[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' ); } t.end(); });