test: migrate math/base/special/fast/asinh to ULP-based assertions - #14079
Merged
Conversation
Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D3zHCEMhwS9mRnbZ9MvaxJ
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request:
math/base/special/fast/asinhfrom computed relative tolerance comparisons (delta = abs( y - expected[i] ); tol = N * EPS * abs( expected[i] ); t.ok( delta <= tol, ... )) to ULP difference assertions using@stdlib/assert/is-almost-same-value, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.test/test.jsandtest/test.native.js.Only the two test files are modified; no implementation or fixture changes.
ULP bounds
Bounds were tightened agentically: starting from
64and lowering to the minimum integer which still passes over the full fixture set. The measured maximum ULP difference per fixture set is:smaller(n=503)[-0.8,0.8](odd function)50.0 * EPS79small_negative(n=503)[-1.0,-0.8]1.5 * EPS2small_positive(n=503)[0.8,1.0]1.5 * EPS2medium_negative(n=503)[-3.0,-1.0]2.0 * EPS2medium_positive(n=503)[1.0,3.0]2.0 * EPS2large_positive(n=503)[3.0,28.0]1.0 * EPS1large_negative(n=503)[-28.0,-3.0]1.0 * EPS1larger_positive(n=503)[28.0,100.0]1.0 * EPS1larger_negative(n=503)[-100.0,-28.0]1.0 * EPS1The bounds are minimal: decrementing every bound by one (
79 → 78,2 → 1,1 → 0) yields 192 failing assertions, with at least one failure in each of the nine fixture loops.The larger bound on the
smallerfixture set is expected for this package:fast/asinhevaluatesln( x + sqrt( x*x + 1 ) )directly, so for small|x|the argument tolnis close to1and cancellation dominates the error. The worst case is at the smallest magnitude in that set (x = -0.006374501992031873). This mirrors the previous50.0 * EPSrelative tolerance, which was already loosened for that interval relative to the others.The JavaScript and native implementations were measured independently and produce identical maximum ULP differences (79 / 2 / 2 / 2 / 2 / 1 / 1 / 1 / 1), so
test.jsandtest.native.jsuse the same bounds.Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
No.
Other
Verification performed:
test/test.js: 4536 assertions passing; run twice at the final bounds with identical results (no FMA/arch nondeterminism observed).test/test.native.js: the native addon was built locally vianode-gyp rebuild, so these tests ran for real rather than being skipped — 4536 assertions passing, also run twice.etc/eslint/.eslintrc.tests.js(the config theeslint-teststarget uses for test files).git diff --checkclean; tab indentation and trailing-newline conventions preserved.@stdlib/math/base/special/absrequire was removed from both files;@stdlib/constants/float64/epsis retained becauseEPSis still used by the underflow test.Environment note: the editorconfig pre-commit hook could not run in this environment because downloading the
editorconfig-checkerbinary is blocked, so the relevant checks (indentation style, trailing whitespace, final newline, line endings) were verified manually instead.Opened as a draft pending CI.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code running as an unattended scheduled task. It studied prior converted packages (including the already-migrated sibling
math/base/special/fast/acosh, #14004) to match the established idiom, applied the conversion, and empirically searched for the minimum passing ULP bound for each fixture set.@stdlib-js/reviewers
Generated by Claude Code