Repository navigation
test: migrate stats/chi2gof to ULP-based assertions - #15687
Merged
Merged
Conversation
Migrate the relative tolerance assertions in the `stats/chi2gof` test suite to ULP-based assertions using `@stdlib/assert/is-almost-same-value`. The ULP bounds are the measured minimums for the existing fixture values: 4 ULP for `pValue` and 2 ULP for `statistic`. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FrmMNwQtd5wpBrd7YKaLf
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:
stats/chi2goffrom relative tolerance assertions to ULP-based assertions using@stdlib/assert/is-almost-same-value, following the idiom established in the already-migrated siblingstats/chi2test.@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires, along with the associateddelta/toldeclarations.test/test.jsonly. No other test file in the package contains relative tolerance assertions, and the package has no native (*.native.js) tests.ULP measurement
Each converted assertion was swept downward from a high bound to the minimum integer that still passes over the full fixture set:
yis array of probabilities)out.pValue0.040594043344781230.0405940433447812yis array of probabilities)out.statistic9.9901433691756279.99014336917563yis array of expected counts)out.pValue0.040594043344781230.0405940433447812yis array of expected counts)out.statistic9.9901433691756279.99014336917563Accordingly, the final bounds are 4 ULP for
pValueand 2 ULP forstatistic. Lowering either bound by one (3 and 1, respectively) causes the corresponding assertions to fail, confirming these are the tightest bounds. The package test suite was run twice at the final bounds and produced identical, passing results, confirming determinism.Test cases that already asserted exact equality via
t.strictEqualwere left untouched.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
Opened as a draft pending CI.
make eslint-tests TESTS_FILTER=".*/stats/chi2gof/.*"reports no errors (only two pre-existingFIXMEwarnings on untouched lines). Theeditorconfig-checkerbinary could not be downloaded in the environment used to author this change, so EditorConfig conformance (LF endings, tab indentation, no trailing whitespace, final newline) was verified manually instead.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written by Claude Code running as an unattended scheduled task. The agent studied the already-migrated sibling package
stats/chi2testto mirror the established idiom, applied the conversion, and determined the minimum ULP bounds empirically by sweeping bounds against the fixture values.@stdlib-js/reviewers
Generated by Claude Code