Repository navigation
test: migrate math/base/special/truncb to ULP-based assertions - #14170
Merged
Merged
Conversation
Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JrLXUTeSNAoV2Qxr1BMRsL
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/truncbfrom relative tolerance testing to ULP difference testing, as proposed in [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.delta/tolcomputation in the "very small numbers (including subnormals)" test withisAlmostSameValue( v, expected[ i ], 1 ), in bothtest/test.jsandtest/test.native.js.@stdlib/assert/is-almost-same-valuerequire and removes the now unused@stdlib/constants/float64/epsand@stdlib/math/base/special/absrequires.The ULP bound was tightened to the measured minimum of
1ULP for both the JavaScript and native test files. Over the 17 subnormal fixtures, 11 cases match exactly (0 ULP) and 6 cases require exactly 1 ULP (e.g.n = -308returns2.9999999999999997e-308versus an expected3e-308); no case requires more than 1, so0would fail and1is the tightest passing bound. The full test file was run twice at the final bound with identical results (766 passing assertions, no failures).This matches the bound and idiom already used by the sibling packages
math/base/special/floorb,math/base/special/ceilb, andmath/base/special/truncn, which share the identical fixture set. Note that forb = 10— the case exercised by this test —truncbdelegates totruncnin both the JavaScript and C implementations, so the native path is expected to agree with the already-mergedtruncnnative test at 1 ULP.No implementation files were modified; the only changes are to the two test files.
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
The native tests (
test/test.native.js) were skipped locally, as the native add-on was not built in the environment used to author this change;npm installcould not complete because the available registry mirror had noes-object-atoms@^1.1.2. The JavaScript tests were run directly and pass. Please confirm the native tests in 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. The conversion mirrors the already-merged
floorb/ceilb/truncnmigrations, and the 1 ULP bound was determined empirically by measuring the minimum passing ULP difference for every fixture rather than assumed.@stdlib-js/reviewers
Generated by Claude Code