Repository navigation
test: migrate stats/incr/nanrss to ULP-based assertions - #16284
Merged
Merged
Conversation
Replace the hand-rolled ULP tolerance check in the `stats/incr/nanrss` unit tests with `@stdlib/assert/is-almost-same-value`, mirroring the idiom already used in `stats/incr/rss`. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qgtt3BxHNqCDE6TW4DgEeV
kgryte
marked this pull request as ready for review
October 23, 2026 18:28
Contributor
|
Hello! 👋 We've noticed that you've been opening a number of PRs addressing good first issues. Thank you for your interest and enthusiasm! Now that you've made a few contributions, we suggest no longer working on good first issues. Instead, we encourage you to prioritize cleaning up any PRs which have yet to be merged and then proceed to work on more involved tasks. Not only does this ensure that other new contributors can work on things and get ramped up on all things stdlib, it also ensures that you can spend your time on more challenging problems. 🚀 For ideas for future PRs, feel free to search the codebase for TODOs and FIXMEs and be sure to check out other open issues on the issue tracker. Cheers! |
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:
stats/incr/nanrssunit tests from a computed tolerance check to ULP-based assertions.Previously,
test/test.jsrequired@stdlib/number/float64/base/ulp-differenceand hand-rolled the comparison as anif ( actual === expected ) { ... } else { diff = ulpdiff( actual, expected ); t.strictEqual( diff <= 1, ... ) }branch. This replaces that with a singlet.strictEqual( isAlmostSameValue( actual, expected, 0 ), true, 'returns expected value' )assertion backed by@stdlib/assert/is-almost-same-value, matching the idiom already used in the sibling packagestats/incr/rss.Final ULP constant:
0(both assertion sites).The bound was tightened empirically rather than assumed. Starting from
64, the full test suite was re-run while lowering the bound (64 → 32 → 16 → 8 → 4 → 2 → 1 → 0); all 13 assertions pass at every value down to and including0, so0is the measured minimum. This is expected to be exact and platform-independent: the accumulator sums squares of integer-valued residuals, so every intermediate value is exactly representable in double precision. The suite was run twice at the final bound to confirm determinism (13/13 passing both times).Only test code is touched; no behavior, documentation, or benchmark changes are included.
Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
The previous assertion allowed a 1 ULP difference, while the measured minimum here is
0. This PR uses0per the "minimum required ULP value" guidance in #11352 and for consistency withstats/incr/rss, but happy to relax it back to1if reviewers would prefer to retain a margin.Other
Verification performed:
make test TESTS_FILTER=".*/stats/incr/nanrss/.*"→ 13/13 passing (run twice).etc/eslint/.eslintrc.tests.js.make lint-editorconfig-filescould not be run in this environment because theeditorconfig-checkerbinary download is blocked by the sandbox network policy. The file was checked manually instead: LF line endings, UTF-8, tab indentation, final newline present, and no trailing-whitespace changes relative todevelop.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written primarily by Claude Code, including locating the candidate package, mirroring the conversion idiom from the already-converted
stats/incr/rss, and empirically tightening the ULP bound.@stdlib-js/reviewers
Generated by Claude Code