From 09ce9157ac4f608fa72a10f7d3e1a85b01202c31 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 5 Aug 2026 21:16:40 +0000 Subject: [PATCH 1/3] test: migrate `math/base/special/asech` to ULP-based assertions Replace the EPS-scaled tolerance comparison in the fixture-based test with `isAlmostSameValue`, tightened to a measured 1 ULP bound. Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01GJNm47UayTwgvhS8FigYFp --- 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/asech/test/test.js | 17 ++++++-------- .../base/special/asech/test/test.native.js | 23 +++++++------------ 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/asech/test/test.js b/lib/node_modules/@stdlib/math/base/special/asech/test/test.js index 10cf7bc9a8cd..c170405121f1 100644 --- a/lib/node_modules/@stdlib/math/base/special/asech/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/asech/test/test.js @@ -21,14 +21,19 @@ // MODULES // var tape = require( 'tape' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var randu = require( '@stdlib/random/base/randu' ); var EPS = require( '@stdlib/constants/float64/eps' ); var PINF = require( '@stdlib/constants/float64/pinf' ); -var abs = require( '@stdlib/math/base/special/abs' ); var asech = require( './../lib' ); +// VARIABLES // + +var ULP_TOL = 1; + + // FIXTURES // var data = require( './fixtures/julia/data.json' ); @@ -44,8 +49,6 @@ tape( 'main export is a function', function test( t ) { tape( 'the function computes the hyperbolic arcsecant on the interval (0, 1]', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -55,13 +58,7 @@ tape( 'the function computes the hyperbolic arcsecant on the interval (0, 1]', f for ( i = 0; i < x.length; i++ ) { y = asech( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 1.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], ULP_TOL ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/asech/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/asech/test/test.native.js index 351859c4aed9..38897d5b9e10 100644 --- a/lib/node_modules/@stdlib/math/base/special/asech/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/asech/test/test.native.js @@ -22,25 +22,26 @@ 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 randu = require( '@stdlib/random/base/randu' ); var EPS = require( '@stdlib/constants/float64/eps' ); var PINF = require( '@stdlib/constants/float64/pinf' ); -var abs = require( '@stdlib/math/base/special/abs' ); var tryRequire = require( '@stdlib/utils/try-require' ); -// FIXTURES // - -var data = require( './fixtures/julia/data.json' ); - - // VARIABLES // var asech = tryRequire( resolve( __dirname, './../lib/native.js' ) ); var opts = { 'skip': ( asech instanceof Error ) }; +var ULP_TOL = 1; + + +// FIXTURES // + +var data = require( './fixtures/julia/data.json' ); // TESTS // @@ -53,8 +54,6 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function computes the hyperbolic arcsecant on the interval (0, 1]', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -64,13 +63,7 @@ tape( 'the function computes the hyperbolic arcsecant on the interval (0, 1]', o for ( i = 0; i < x.length; i++ ) { y = asech( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 1.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], ULP_TOL ), true, 'returns expected value' ); } t.end(); }); From f5adc794e3e5086bd15d14b45d4252abda702930 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 5 Aug 2026 23:55:38 -0700 Subject: [PATCH 2/3] test: inline value Signed-off-by: Athan --- .../@stdlib/math/base/special/asech/test/test.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/asech/test/test.js b/lib/node_modules/@stdlib/math/base/special/asech/test/test.js index c170405121f1..a1a0cc71d738 100644 --- a/lib/node_modules/@stdlib/math/base/special/asech/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/asech/test/test.js @@ -29,11 +29,6 @@ var PINF = require( '@stdlib/constants/float64/pinf' ); var asech = require( './../lib' ); -// VARIABLES // - -var ULP_TOL = 1; - - // FIXTURES // var data = require( './fixtures/julia/data.json' ); @@ -58,7 +53,7 @@ tape( 'the function computes the hyperbolic arcsecant on the interval (0, 1]', f for ( i = 0; i < x.length; i++ ) { y = asech( x[i] ); - t.strictEqual( isAlmostSameValue( y, expected[ i ], ULP_TOL ), true, 'returns expected value' ); + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); From eb39bc180c3f208651b164934ba01261dc97a7d7 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 5 Aug 2026 23:55:58 -0700 Subject: [PATCH 3/3] test: inline value Signed-off-by: Athan --- .../@stdlib/math/base/special/asech/test/test.native.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/asech/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/asech/test/test.native.js index 38897d5b9e10..ed09d5e19f6e 100644 --- a/lib/node_modules/@stdlib/math/base/special/asech/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/asech/test/test.native.js @@ -36,7 +36,6 @@ var asech = tryRequire( resolve( __dirname, './../lib/native.js' ) ); var opts = { 'skip': ( asech instanceof Error ) }; -var ULP_TOL = 1; // FIXTURES // @@ -63,7 +62,7 @@ tape( 'the function computes the hyperbolic arcsecant on the interval (0, 1]', o for ( i = 0; i < x.length; i++ ) { y = asech( x[i] ); - t.strictEqual( isAlmostSameValue( y, expected[ i ], ULP_TOL ), true, 'returns expected value' ); + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); });