test: migrate math/base/special/fast/acosh to ULP-based assertions - #14004
Merged
Conversation
Replaces computed relative tolerance comparisons with `isAlmostSameValue` ULP difference assertions. The ULP bounds are the measured minimums over the full fixture sets for both the JavaScript and native implementations. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UViLFYQZDZTmUPew8Kdh85
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/acoshfrom 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:medium_positive([1.0,3.0], n=507)[1.0,3.0]6.0 * EPS8large_positive([3.0,28.0], n=507)[3.0,28.0]1.0 * EPS1larger_positive([28.0,100.0], n=507)[28.0,100.0]1.0 * EPS1huge_positive(n=1003)1.0 * EPS1The bounds are minimal: lowering the
[1.0,3.0]bound to7fails, and lowering any of the1bounds to0(exact equality) fails.The larger bound on
[1.0,3.0]is expected for this package:fast/acoshevaluatesln( x + sqrt(x+1)*sqrt(x-1) )directly, so cancellation inx-1nearx = 1dominates the error there. This mirrors the previous6.0 * EPSrelative tolerance, which was already loosened for that interval.The JavaScript and native implementations were measured independently and produce identical maximum ULP differences (8 / 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: 3527 assertions passing; run twice at the final bounds with identical results (no FMA/arch nondeterminism observed).test/test.native.js: native addon was built locally vianode-gyp rebuild, so these tests ran for real rather than being skipped — 3527 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.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/acosh) 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