From b91f3dd3871409fce7d9ffd3d0569b87f0589665 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 12 Oct 2026 18:23:17 +0000 Subject: [PATCH 1/2] test: migrate `constants/float32/pi-squared` to ULP-based assertions Replace the relative tolerance assertion in the test suite with a ULP difference assertion via `@stdlib/number/float32/base/assert/is-almost-same-value`. The measured minimum ULP bound is `1`. Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01RWwXztzfFcS6UC8AYLZenG --- 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: na - 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 --- --- .../@stdlib/constants/float32/pi-squared/test/test.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/constants/float32/pi-squared/test/test.js b/lib/node_modules/@stdlib/constants/float32/pi-squared/test/test.js index 78adcdb808b2..d6d58618fdef 100644 --- a/lib/node_modules/@stdlib/constants/float32/pi-squared/test/test.js +++ b/lib/node_modules/@stdlib/constants/float32/pi-squared/test/test.js @@ -21,10 +21,9 @@ // MODULES // var tape = require( 'tape' ); +var isAlmostSameValue = require( '@stdlib/number/float32/base/assert/is-almost-same-value' ); var pow = require( '@stdlib/math/base/special/pow' ); -var absf = require( '@stdlib/math/base/special/absf' ); var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); -var EPS = require( '@stdlib/constants/float32/eps' ); var PI = require( '@stdlib/constants/float32/pi' ); var FLOAT32_PI_SQUARED = require( './../lib' ); @@ -43,15 +42,11 @@ tape( 'export is a single-precision floating-point number equal to 9.86960411071 }); tape( 'export equals π²', function test( t ) { - var delta; - var tol; var v; v = float64ToFloat32( pow( PI, 2 ) ); - delta = absf( FLOAT32_PI_SQUARED - v ); - tol = EPS * v; + t.strictEqual( isAlmostSameValue( v, FLOAT32_PI_SQUARED, 1 ), true, 'returns expected value' ); - t.ok( delta <= tol, 'equals π² within tolerance '+tol+'. v: '+v+'. π²: '+FLOAT32_PI_SQUARED+'.' ); t.end(); }); From e9652815fc099b5ec1c9bb0da822f608d7194765 Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 13 Oct 2026 12:46:24 +0200 Subject: [PATCH 2/2] style: remove whitespace Signed-off-by: Athan --- .../@stdlib/constants/float32/pi-squared/test/test.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/constants/float32/pi-squared/test/test.js b/lib/node_modules/@stdlib/constants/float32/pi-squared/test/test.js index d6d58618fdef..70a34d8852a4 100644 --- a/lib/node_modules/@stdlib/constants/float32/pi-squared/test/test.js +++ b/lib/node_modules/@stdlib/constants/float32/pi-squared/test/test.js @@ -42,11 +42,7 @@ tape( 'export is a single-precision floating-point number equal to 9.86960411071 }); tape( 'export equals π²', function test( t ) { - var v; - - v = float64ToFloat32( pow( PI, 2 ) ); - + var v = float64ToFloat32( pow( PI, 2 ) ); t.strictEqual( isAlmostSameValue( v, FLOAT32_PI_SQUARED, 1 ), true, 'returns expected value' ); - t.end(); });