test: migrate stats/base/dists/erlang/mean to ULP-based assertions - #14593
Draft
kgryte wants to merge 1 commit into
Draft
test: migrate stats/base/dists/erlang/mean to ULP-based assertions#14593kgryte wants to merge 1 commit into
stats/base/dists/erlang/mean to ULP-based assertions#14593kgryte wants to merge 1 commit into
Conversation
Replace the relative-tolerance comparison (and its exact-equality fast-path branch) in the fixture loop with an `isAlmostSameValue` assertion using a bound of 1 ULP, which is the minimum integer bound which passes over the full fixture set for both the JavaScript and native implementations. Ref: #11352
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/erlang/meanfrom relative-tolerance comparisons to ULP-based assertions using@stdlib/assert/is-almost-same-value.abs( y - expected[i] ) <= tol(wheretol = 1.0 * EPS * abs( expected[i] )) idiom, along with itsy === expected[i]fast-path branch, witht.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' )and removes the now-unusedabsandEPSimports.test/test.jsandtest/test.native.js.The ULP bound was tightened to the minimum integer which passes over the full fixture set (200 fixture values): 1 ULP, for both
test/test.jsandtest/test.native.js. The bound is genuinely minimal — at a bound of0ULPs, 44 of the 200 fixture values fail for both the JavaScript and the native implementation, so the bound cannot be lowered further.The JavaScript and C implementations agree exactly here: sweeping each fixture value individually, both require a maximum of 1 ULP and both diverge from the Julia fixtures on the same 44 values, which is consistent with both computing a single division
k / lambdaand the fixtures having been generated in a different order of operations.The native addon was built locally so that
test/test.native.jsactually executed rather than skipping. Both suites were run twice at the final bound and pass deterministically (217 assertions intest/test.jsand 215 intest/test.native.js, per run, no failures). Only the test files are modified.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
The repository's
editorconfig-checkerlint step could not run in this environment, as the tool is downloaded on demand from a third-party GitHub release which was unreachable from the sandbox. The two changed files were instead verified by hand against.editorconfig(LF endings, UTF-8, tab indentation, no trailing whitespace, final newline). ESLint (tests configuration), the license-header lint, and the filename lint all ran and passed.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code, following the migration pattern established in prior ULP-conversion PRs. The minimum ULP bound was measured empirically against the package's fixtures.
@stdlib-js/reviewers
Generated by Claude Code