test: migrate stats/base/dists/bernoulli/entropy to ULP-based assertions - #15305
Merged
Merged
Conversation
…tions Replaces relative tolerance assertions with `isAlmostSameValue` ULP comparisons in `test/test.js` and `test/test.native.js`. All 1000 Julia fixtures match exactly, so the minimum required ULP bound is 0. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NUvo5jMirGmycRpJjKXJLT
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/bernoulli/entropyfrom relative tolerance (EPS) testing to ULP difference testing in bothtest/test.jsandtest/test.native.js.delta/tolcomparison witht.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );and adds the@stdlib/assert/is-almost-same-valuerequire, dropping the now-unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires.Final ULP constant:
0(bothtest/test.jsandtest/test.native.js).The bound was tightened empirically. Starting from a high bound (64) and lowering, the minimum integer that still passes over the full fixture set is
0: measuring the minimum required ULP distance for every one of the 1000 Julia fixtures intest/fixtures/julia/data.jsonyields0for all 1000 (i.e., the JavaScript implementation reproduces every fixture value exactly), so0is both the measured minimum and the floor. The suite was run twice at the final bound with identical results (1009/1009 assertions passing), confirming determinism.Note:
test/test.native.jsuses the same bound of0, matching the convention used by already-migrated sibling packages (e.g.stats/base/dists/bernoulli/skewness). The native tests self-skip when the add-on is not built, and the add-on could not be compiled in the environment used to prepare this change, so the native bound is carried over from the JavaScript measurement rather than measured directly. Please flag if CI's native job disagrees.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
Only the two test files are modified; no implementation, fixture, or documentation changes. Lint (
etc/eslint/.eslintrc.tests.js) is clean for both files.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written primarily by Claude Code, which also measured the ULP bound against the fixture set and ran the tests and linter.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01NUvo5jMirGmycRpJjKXJLT
Generated by Claude Code