Repository navigation
test: migrate stats/base/dists/kumaraswamy/stdev to ULP-based assertions - #15533
Merged
Merged
Conversation
…tions Replaces the computed relative-tolerance assertions in `test/test.js` and `test/test.native.js` with `@stdlib/assert/is-almost-same-value`. The ULP bound (10564) is the measured minimum over the full 1000-point Julia fixture set for both the JavaScript and native implementations. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K4KbwigC41ecFnMXdUkDQM --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: skipped - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
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.
Ref #11352.
Description
This pull request:
stats/base/dists/kumaraswamy/stdevfrom computed relative-tolerance assertions to ULP-based assertions, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.delta/tol(EPS-scaled) comparisons intest/test.jsandtest/test.native.jswitht.strictEqual( isAlmostSameValue( y, expected[ i ], N ), true, 'returns expected value' ), adding the@stdlib/assert/is-almost-same-valuerequire and dropping the now-unused@stdlib/constants/float64/epsand@stdlib/math/base/special/absrequires.ULP constants
Both test files use a bound of 10564 ULP, which is the measured minimum over the full 1000-point Julia fixture set:
test/test.js10000 * EPS * abs( expected[ i ] )1056410564test/test.native.js18500 * EPS * abs( expected[ i ] )1056410564The bound was tightened by bisection over the fixture set and then confirmed against the test suite itself: both files pass at
10564and fail with exactly one failing assertion at10563(worst case:a = 0.5981637562600661,b = 0.00034899264986798517). The suites were run twice at the final bound with identical results.The native add-on was built locally (
node-gyp rebuild) so thattest/test.native.jsactually executed rather than being skipped; it required the same bound as the JavaScript implementation, so the previously more lenient native tolerance has been tightened to match. Measurements were taken on x86-64 Linux, Node.js v22.The existing comment explaining why a high tolerance is needed (compounding error in
σ = √(m₂ - m₁²)) has been preserved above the fixture loop, since it also explains the relatively large ULP bound.Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
test/test.native.jspreviously allowed a more lenient tolerance thantest/test.js(18500vs.10000timesEPS). On x86-64 Linux the locally built add-on needs no more headroom than the JavaScript implementation, so both files now use10564. If that extra headroom was added for a specific platform, reviewers may prefer a larger bound for the native test.Other
Opened as a draft pending review of the ULP bounds above.
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: it selected the package, studied previously merged ULP migrations for the established idiom, performed the test conversion, and measured the minimum ULP bound empirically.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01K4KbwigC41ecFnMXdUkDQM
Generated by Claude Code