From 28310a6039a87a83422f99a9394f2cd1e6be96a9 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Tue, 13 Oct 2026 02:24:33 +0000 Subject: [PATCH] test: migrate `constants/float64/half-ln-two` to ULP-based assertions Replace the relative tolerance assertion in the `export equals 0.5*ln(2)` test case with an ULP difference assertion using `@stdlib/assert/is-almost-same-value`. The `delta`/`tol` computations and the now-unused `@stdlib/math/base/special/abs` and `@stdlib/constants/float64/eps` imports are removed. `0.5 * ln( 2.0 )` is bit-identical to the exported constant, so the measured ULP difference is 0, which is also the tightest possible bound. Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_017CV9AEfa7wkGtWEebxsa3M --- 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 --- --- .../constants/float64/half-ln-two/test/test.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/node_modules/@stdlib/constants/float64/half-ln-two/test/test.js b/lib/node_modules/@stdlib/constants/float64/half-ln-two/test/test.js index 35cfd8eee01c..e4edf4b19d2b 100644 --- a/lib/node_modules/@stdlib/constants/float64/half-ln-two/test/test.js +++ b/lib/node_modules/@stdlib/constants/float64/half-ln-two/test/test.js @@ -22,8 +22,7 @@ var tape = require( 'tape' ); var ln = require( '@stdlib/math/base/special/ln' ); -var abs = require( '@stdlib/math/base/special/abs' ); -var EPS = require( '@stdlib/constants/float64/eps' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var HALF_LN2 = require( './../lib' ); @@ -41,15 +40,7 @@ tape( 'export is a double-precision floating-point number equal to `3.4657359027 }); tape( 'export equals `0.5*ln(2)`', function test( t ) { - var delta; - var tol; - var v; - - v = 0.5 * ln( 2.0 ); - delta = abs( v - HALF_LN2 ); - tol = EPS * HALF_LN2; - - t.ok( delta <= tol, 'equals 0.5*ln(2) within tolerance '+tol ); - + var v = 0.5 * ln( 2.0 ); + t.strictEqual( isAlmostSameValue( v, HALF_LN2, 0 ), true, 'returns expected value' ); t.end(); });