Repository navigation
test: migrate math/base/special/fast/hypot to ULP-based assertions - #14375
Merged
Merged
Conversation
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.
Resolves a part of #11352.
Description
This pull request:
math/base/special/fast/hypotfrom relative tolerance assertions to ULP difference assertions, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.delta/tolcomparison (tol = 1.4 * EPS * abs( expected[ i ] )) intest/test.jsandtest/test.native.jswitht.strictEqual( isAlmostSameValue( h, expected[ i ], 1 ), true, 'returns expected value' );.@stdlib/assert/is-almost-same-valuerequire and drops the now-unused@stdlib/constants/float64/epsand@stdlib/math/base/special/absrequires.Only the two test files are changed; no implementation, fixture, or documentation changes are included.
ULP bound:
1in bothtest/test.jsandtest/test.native.js.The bound was measured, not guessed. Iterating downward over the full 2003-value Julia fixture set, the maximum observed ULP difference is
1for both the JavaScript and native implementations (worst case at index 3:x = -288.6569990349477,y = 45.66311946727046), so1is the minimum value that passes.0fails: 243 of the 2003 native results and a comparable share of the JavaScript results are not bit-exact against the fixtures. Both implementations computesqrt( (x*x) + (y*y) ), and the native addon was built locally sotest/test.native.jsactually executed rather than being skipped; the two suites were each run twice at the final bound with identical results, so no FMA-contraction or architecture-dependent variation was observed.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:
make test TESTS_FILTER=".*/math/base/special/fast/hypot/.*"— 2010 passing, run twice.test/test.native.jsexecuted directly against a locally built addon — 2010 passing, run twice.etc/eslint/.eslintrc.tests.js.Note: the
lint-editorconfigpre-commit hook could not run in this environment because it downloads its checker binary from a GitHub repository that is out of scope for this session. The two changed files were verified manually against.editorconfig(LF endings, UTF-8, tab indentation, no trailing whitespace, final newline present).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. Claude Code selected the package, studied previously merged ULP migrations to match the established idiom, applied the test edits, and determined the ULP bound empirically by scanning the fixture set and re-running the suites.
@stdlib-js/reviewers
Generated by Claude Code