From 6493bed36227bc678b6946d7168dca68eff50e7b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 19 Aug 2026 21:19:21 +0000 Subject: [PATCH 1/2] test: migrate `math/base/special/betaincinv` to ULP-based assertions 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 --- --- .../math/base/special/betaincinv/test/test.js | 25 ++++--------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js b/lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js index 3d78b662579f..80eb789d3dc5 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/betaincinv/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 betaincinv = require( './../lib' ); @@ -120,43 +119,29 @@ tape( 'if provided a nonpositive `b`, the function returns `NaN`', function test }); tape( 'the function evaluates the inverse of the lower regularized incomplete beta function', function test( t ) { + var LOWER_ULP_TOL = 20; var expected; - var delta; - var tol; var i; var y; expected = lowerRegularized; for ( i = 0; i < x.length; i++ ) { y = betaincinv( x[i], a[i], b[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+'. a: '+a[i]+'. b: '+b[i]+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 15.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. a: '+a[i]+'. b: '+b[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], LOWER_ULP_TOL ), true, 'returns expected value' ); } t.end(); }); tape( 'the function evaluates the inverse of the upper regularized incomplete beta function', function test( t ) { + var UPPER_ULP_TOL = 14; var expected; - var delta; - var tol; var i; var y; expected = upperRegularized; for ( i = 0; i < x.length; i++ ) { y = betaincinv( x[i], a[i], b[i], true ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+'. a: '+a[i]+'. b: '+b[i]+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 15.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. a: '+a[i]+'. b: '+b[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], UPPER_ULP_TOL ), true, 'returns expected value' ); } t.end(); }); From 9185f0acb6d55affa870c1a7b8b8d4c3392a03c6 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 19 Aug 2026 18:54:19 -0700 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../@stdlib/math/base/special/betaincinv/test/test.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js b/lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js index 80eb789d3dc5..68db83ffddbd 100644 --- a/lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/betaincinv/test/test.js @@ -119,7 +119,6 @@ tape( 'if provided a nonpositive `b`, the function returns `NaN`', function test }); tape( 'the function evaluates the inverse of the lower regularized incomplete beta function', function test( t ) { - var LOWER_ULP_TOL = 20; var expected; var i; var y; @@ -127,13 +126,12 @@ tape( 'the function evaluates the inverse of the lower regularized incomplete be expected = lowerRegularized; for ( i = 0; i < x.length; i++ ) { y = betaincinv( x[i], a[i], b[i] ); - t.strictEqual( isAlmostSameValue( y, expected[ i ], LOWER_ULP_TOL ), true, 'returns expected value' ); + t.strictEqual( isAlmostSameValue( y, expected[ i ], 20 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function evaluates the inverse of the upper regularized incomplete beta function', function test( t ) { - var UPPER_ULP_TOL = 14; var expected; var i; var y; @@ -141,7 +139,7 @@ tape( 'the function evaluates the inverse of the upper regularized incomplete be expected = upperRegularized; for ( i = 0; i < x.length; i++ ) { y = betaincinv( x[i], a[i], b[i], true ); - t.strictEqual( isAlmostSameValue( y, expected[ i ], UPPER_ULP_TOL ), true, 'returns expected value' ); + t.strictEqual( isAlmostSameValue( y, expected[ i ], 14 ), true, 'returns expected value' ); } t.end(); });