Repository navigation
test: migrate stats/base/dists/weibull/entropy to ULP-based assertions - #14543
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:
stats/base/dists/weibull/entropyfrom relative tolerance testing to ULP difference testing, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.delta/tolcomparisons intest/test.jsandtest/test.native.jswitht.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );, adding the@stdlib/assert/is-almost-same-valuerequire and dropping the now unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires.ULP bound:
0(bothtest/test.jsandtest/test.native.js), the measured minimum over the fixture set.The bound was determined empirically rather than assumed: for every fixture, the minimum admissible bound was found by searching upward over
isAlmostSameValue, and the maximum over the full Julia fixture set (all 500 values are compared) is exactly0— every returned value is bit-identical to the Julia reference, so the previouselsebranch computingdelta/tolwas never exercised.0is the floor of the allowed range, so the bound cannot be tightened further. The suite was then run twice at the final bound with identical results (514/514 passing in each run), so the bound is not sensitive to run-to-run variation.The previous relative tolerance was
1.0 * EPS, so this is a tightening rather than a loosening of the prior accuracy budget.To confirm that
0is also correct for the C implementation, the native addon was compiled locally vianode-gyp rebuildandtest/test.native.jswas executed against the real addon: it likewise passes all 514 assertions at0ULP, twice. This matches the sibling conversions in this family (weibull/stdev,weibull/cdf,weibull/logcdf), which likewise use a single bound across both suites.Only the two test files are modified; no implementation, fixture, or documentation 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
No.
Other
Note on local verification:
make install-node-modulesinitially failed in this environment because a transitive dependency requestses-object-atoms@^1.1.2, a version which does not exist on the registry (1.1.1is the latest published). Installation was completed locally with a temporaryoverridesentry pinninges-object-atomsto1.1.1;package.jsonwas restored afterwards and is not part of this diff. Separately,make lint-editorconfig-filescould not run because theeditorconfig-checkerbinary download is blocked in this environment; the changed files were instead checked manually for indentation, trailing whitespace, line endings, and final newline, and match the surrounding files exactly.eslintwas run againstetc/eslint/.eslintrc.tests.jsand reports no problems for either file.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. It studied previously merged conversions under #11352 (including the
weibull/stdevsibling) to match the established idiom, applied the migration, measured the minimum ULP bound empirically against the fixtures for both the JavaScript and the locally compiled C implementation, and verified that the tests pass and that the files lint cleanly.@stdlib-js/reviewers
Generated by Claude Code