Repository navigation
test: migrate stats/incr/nanmmpe to ULP-based assertions - #16015
Merged
Merged
Conversation
Replaces relative tolerance assertions with ULP difference assertions using `@stdlib/assert/is-almost-same-value`. The ULP bound was tightened to the measured minimum of 1 ULP. Resolves a part of #11352. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019LRi44byiqKb1zH1gx1krz
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
kgryte
marked this pull request as ready for review
October 11, 2026 12:39
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/nanmmpefrom 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.Specifically, in
test/test.js:@stdlib/assert/is-almost-same-valueimport and removes the now unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsimports.delta/tolcomputation (and the corresponding variable declarations) in the test which checks that the accumulator function computes a moving mean percentage error incrementally.t.equal( delta <= tol, ... )tolerance branch witht.strictEqual( isAlmostSameValue( actual, expected[i], 1 ), true, 'returns expected value' );.The final ULP constant is
1, which is the measured minimum. Starting from a loose bound of64and tightening over the full fixture set,1is the smallest integer which passes: at0, three of the six fixture assertions fail. The suite was run twice at the final bound to confirm the result is deterministic (98 passing on both runs).For reference, the non-
NaNsibling package,stats/incr/mmpe, which shares the same fixture values, was previously migrated using the same1ULP bound.No changes were made to the exact-equality assertions elsewhere in the file, as those compare exactly representable values and are correct as-is.
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=".*/stats/incr/nanmmpe/.*"→ 98 passing, 0 failing (run twice at the final ULP bound).make lint-javascript-filesreports an identical set of 13 pre-existing problems both before and after this change (these stem from the target applying the source ESLint overrides to a test file).lib/node_modules/@stdlib/stats/incr/nanmmpe/test/test.js.This package has no
test/test.native.js, so onlytest/test.jsrequired updating.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code. It studied the already-migrated sibling package
stats/incr/mmpeto mirror the established project idiom, applied the migration, and determined the minimum passing ULP bound empirically by running the test suite across decreasing bounds.@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_019LRi44byiqKb1zH1gx1krz
Generated by Claude Code