From 2fa66366d869a0f29763f6abc2678ab7e86df3ef Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 5 Aug 2026 01:30:33 +0000 Subject: [PATCH 1/3] test: migrate `math/base/special/falling-factorial` to ULP-based assertions Replaces the computed relative-tolerance assertions in the fixture loops with `@stdlib/assert/is-almost-same-value`. The ULP bounds correspond to the measured minimum ULP difference over each full fixture set for both the JavaScript and native implementations. Ref: https://github.com/stdlib-js/stdlib/issues/11352 --- 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 --- --- .../special/falling-factorial/test/test.js | 42 ++++++------------- .../falling-factorial/test/test.native.js | 42 ++++++------------- 2 files changed, 26 insertions(+), 58 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/falling-factorial/test/test.js b/lib/node_modules/@stdlib/math/base/special/falling-factorial/test/test.js index 4cbb03011fba..25a656dc9cf8 100644 --- a/lib/node_modules/@stdlib/math/base/special/falling-factorial/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/falling-factorial/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 abs = require( '@stdlib/math/base/special/abs' ); var PINF = require( '@stdlib/constants/float64/pinf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var fallingFactorial = require( './../lib' ); @@ -91,8 +90,7 @@ tape( 'the function returns `+infinity` for small `x` and large `n`', function t tape( 'the function evaluates the falling factorial for large `x`', function test( t ) { var expected; - var delta; - var tol; + var ulps; var i; var n; var x; @@ -101,23 +99,18 @@ tape( 'the function evaluates the falling factorial for large `x`', function tes expected = large.expected; x = large.x; n = large.n; + + ulps = 116; for ( i = 0; i < x.length; i++ ) { y = fallingFactorial( x[i], n[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+'. n: '+n[i]+', y: '+y+'. expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 80.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. n: '+n[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], ulps ), true, 'returns expected value' ); } t.end(); }); tape( 'the function evaluates the falling factorial for small `x`', function test( t ) { var expected; - var delta; - var tol; + var ulps; var i; var n; var x; @@ -126,23 +119,18 @@ tape( 'the function evaluates the falling factorial for small `x`', function tes expected = small.expected; x = small.x; n = small.n; + + ulps = 117; for ( i = 0; i < x.length; i++ ) { y = fallingFactorial( x[i], n[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+'. n: '+n[i]+', y: '+y+'. expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 80.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. n: '+n[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], ulps ), true, 'returns expected value' ); } t.end(); }); tape( 'the function evaluates the falling factorial for negative `x`', function test( t ) { var expected; - var delta; - var tol; + var ulps; var i; var n; var x; @@ -151,15 +139,11 @@ tape( 'the function evaluates the falling factorial for negative `x`', function expected = negative.expected; x = negative.x; n = negative.n; + + ulps = 150; for ( i = 0; i < x.length; i++ ) { y = fallingFactorial( x[i], n[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+'. n: '+n[i]+', y: '+y+'. expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 100.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. n: '+n[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], ulps ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/falling-factorial/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/falling-factorial/test/test.native.js index fe89798c6318..48bdd09eee8d 100644 --- a/lib/node_modules/@stdlib/math/base/special/falling-factorial/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/falling-factorial/test/test.native.js @@ -22,10 +22,9 @@ var resolve = require( 'path' ).resolve; 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 EPS = require( '@stdlib/constants/float64/eps' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -88,8 +87,7 @@ tape( 'the function returns `+infinity` for small `x` and large `n`', opts, func tape( 'the function evaluates the falling factorial for large `x`', opts, function test( t ) { var expected; - var delta; - var tol; + var ulps; var i; var n; var x; @@ -98,23 +96,18 @@ tape( 'the function evaluates the falling factorial for large `x`', opts, functi expected = large.expected; x = large.x; n = large.n; + + ulps = 116; for ( i = 0; i < x.length; i++ ) { y = fallingFactorial( x[i], n[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+'. n: '+n[i]+', y: '+y+'. expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 80.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. n: '+n[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], ulps ), true, 'returns expected value' ); } t.end(); }); tape( 'the function evaluates the falling factorial for small `x`', opts, function test( t ) { var expected; - var delta; - var tol; + var ulps; var i; var n; var x; @@ -123,23 +116,18 @@ tape( 'the function evaluates the falling factorial for small `x`', opts, functi expected = small.expected; x = small.x; n = small.n; + + ulps = 117; for ( i = 0; i < x.length; i++ ) { y = fallingFactorial( x[i], n[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+'. n: '+n[i]+', y: '+y+'. expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 80.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. n: '+n[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], ulps ), true, 'returns expected value' ); } t.end(); }); tape( 'the function evaluates the falling factorial for negative `x`', opts, function test( t ) { var expected; - var delta; - var tol; + var ulps; var i; var n; var x; @@ -148,15 +136,11 @@ tape( 'the function evaluates the falling factorial for negative `x`', opts, fun expected = negative.expected; x = negative.x; n = negative.n; + + ulps = 150; for ( i = 0; i < x.length; i++ ) { y = fallingFactorial( x[i], n[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+'. n: '+n[i]+', y: '+y+'. expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 100.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. n: '+n[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], ulps ), true, 'returns expected value' ); } t.end(); }); From 84697ae08d70f172346e937be34474793c6293b2 Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 4 Aug 2026 23:46:32 -0700 Subject: [PATCH 2/3] test: remove variable Signed-off-by: Athan --- .../math/base/special/falling-factorial/test/test.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/falling-factorial/test/test.js b/lib/node_modules/@stdlib/math/base/special/falling-factorial/test/test.js index 25a656dc9cf8..877a9219bfd7 100644 --- a/lib/node_modules/@stdlib/math/base/special/falling-factorial/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/falling-factorial/test/test.js @@ -90,7 +90,6 @@ tape( 'the function returns `+infinity` for small `x` and large `n`', function t tape( 'the function evaluates the falling factorial for large `x`', function test( t ) { var expected; - var ulps; var i; var n; var x; @@ -100,17 +99,15 @@ tape( 'the function evaluates the falling factorial for large `x`', function tes x = large.x; n = large.n; - ulps = 116; for ( i = 0; i < x.length; i++ ) { y = fallingFactorial( x[i], n[i] ); - t.strictEqual( isAlmostSameValue( y, expected[ i ], ulps ), true, 'returns expected value' ); + t.strictEqual( isAlmostSameValue( y, expected[ i ], 116 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function evaluates the falling factorial for small `x`', function test( t ) { var expected; - var ulps; var i; var n; var x; @@ -120,17 +117,15 @@ tape( 'the function evaluates the falling factorial for small `x`', function tes x = small.x; n = small.n; - ulps = 117; for ( i = 0; i < x.length; i++ ) { y = fallingFactorial( x[i], n[i] ); - t.strictEqual( isAlmostSameValue( y, expected[ i ], ulps ), true, 'returns expected value' ); + t.strictEqual( isAlmostSameValue( y, expected[ i ], 117 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function evaluates the falling factorial for negative `x`', function test( t ) { var expected; - var ulps; var i; var n; var x; @@ -140,10 +135,9 @@ tape( 'the function evaluates the falling factorial for negative `x`', function x = negative.x; n = negative.n; - ulps = 150; for ( i = 0; i < x.length; i++ ) { y = fallingFactorial( x[i], n[i] ); - t.strictEqual( isAlmostSameValue( y, expected[ i ], ulps ), true, 'returns expected value' ); + t.strictEqual( isAlmostSameValue( y, expected[ i ], 150 ), true, 'returns expected value' ); } t.end(); }); From 21c8eeca67e3b5a7bc4f9be8b1345112758488a0 Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 4 Aug 2026 23:47:20 -0700 Subject: [PATCH 3/3] test: remove variable Signed-off-by: Athan --- .../special/falling-factorial/test/test.native.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/falling-factorial/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/falling-factorial/test/test.native.js index 48bdd09eee8d..2a0695baa2f0 100644 --- a/lib/node_modules/@stdlib/math/base/special/falling-factorial/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/falling-factorial/test/test.native.js @@ -87,7 +87,6 @@ tape( 'the function returns `+infinity` for small `x` and large `n`', opts, func tape( 'the function evaluates the falling factorial for large `x`', opts, function test( t ) { var expected; - var ulps; var i; var n; var x; @@ -97,17 +96,15 @@ tape( 'the function evaluates the falling factorial for large `x`', opts, functi x = large.x; n = large.n; - ulps = 116; for ( i = 0; i < x.length; i++ ) { y = fallingFactorial( x[i], n[i] ); - t.strictEqual( isAlmostSameValue( y, expected[ i ], ulps ), true, 'returns expected value' ); + t.strictEqual( isAlmostSameValue( y, expected[ i ], 116 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function evaluates the falling factorial for small `x`', opts, function test( t ) { var expected; - var ulps; var i; var n; var x; @@ -117,17 +114,15 @@ tape( 'the function evaluates the falling factorial for small `x`', opts, functi x = small.x; n = small.n; - ulps = 117; for ( i = 0; i < x.length; i++ ) { y = fallingFactorial( x[i], n[i] ); - t.strictEqual( isAlmostSameValue( y, expected[ i ], ulps ), true, 'returns expected value' ); + t.strictEqual( isAlmostSameValue( y, expected[ i ], 117 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function evaluates the falling factorial for negative `x`', opts, function test( t ) { var expected; - var ulps; var i; var n; var x; @@ -137,10 +132,9 @@ tape( 'the function evaluates the falling factorial for negative `x`', opts, fun x = negative.x; n = negative.n; - ulps = 150; for ( i = 0; i < x.length; i++ ) { y = fallingFactorial( x[i], n[i] ); - t.strictEqual( isAlmostSameValue( y, expected[ i ], ulps ), true, 'returns expected value' ); + t.strictEqual( isAlmostSameValue( y, expected[ i ], 150 ), true, 'returns expected value' ); } t.end(); });