Repository navigation
test: migrate stats/base/dists/erlang/entropy to ULP-based assertions - #14438
Merged
Merged
Conversation
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
kgryte
approved these changes
Aug 20, 2026
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/erlang/entropytest fixtures from the old computed EPS-based tolerance idiom (delta/tol/abs( delta ) <= tol) to ULP-based assertions using@stdlib/assert/is-almost-same-value, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.test/test.jsandtest/test.native.js.@stdlib/number/float64/base/ulp-difference) between each computed and expected value. The tightest passing bound is22528ULPs, driven by a handful of fixture entries where the expected entropy value is extremely close to zero (e.g.k: 14, lambda: 15.118382880503544, expected: -0.0016827325793946635), causing catastrophic cancellation in the entropy formula and correspondingly large ULP differences despite tiny absolute error. This is consistent with the original test's already-generous15000 * EPSrelative tolerance, which was evidently chosen for the same reason. Verified deterministic by running the suite twice at this bound, and confirmed tight by observing 1 failure at22527.test/test.native.jscould not be exercised in the conversion environment (no compiled native add-on was available, so those tests are skipped viatryRequire), so the same22528bound was applied there for consistency withtest/test.js, mirroring the convention observed in other already-converted packages with native counterparts (e.g.math/base/special/acos).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
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was generated by an automated Claude Code routine that discovers packages still using the old EPS-tolerance test idiom, converts them to
isAlmostSameValue-based ULP assertions mirroring prior art from already-merged conversions in the same package family, and empirically determines the tightest passing ULP bound. Opened as a draft for maintainer review given the unusually large (though empirically verified and precedented) ULP bound.@stdlib-js/reviewers
Generated by Claude Code