test: migrate stats/base/dists/bernoulli/kurtosis to ULP-based assertions - #15372
Conversation
…rtions Replaces the relative tolerance (`EPS`-scaled) fixture comparisons in `test/test.js` and `test/test.native.js` with ULP difference testing via `@stdlib/assert/is-almost-same-value`. All 1000 Julia fixture values match bit-for-bit, 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_01FAk9ZwMqUXA4W8o4t7dbtQ --- 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 ---
|
Hello! 👋 We've noticed that you've been opening a number of PRs addressing good first issues. Thank you for your interest and enthusiasm! Now that you've made a few contributions, we suggest no longer working on good first issues. Instead, we encourage you to prioritize cleaning up any PRs which have yet to be merged and then proceed to work on more involved tasks. Not only does this ensure that other new contributors can work on things and get ramped up on all things stdlib, it also ensures that you can spend your time on more challenging problems. 🚀 For ideas for future PRs, feel free to search the codebase for TODOs and FIXMEs and be sure to check out other open issues on the issue tracker. Cheers! |
Coverage Report
The above coverage report was generated for the changes in this PR. |
|
An automated check found potentially unrelated issue/PR references in this PR:
Why this matters: GitHub automatically closes issues referenced with What to do:
This assessment was generated by an AI model and is informational only. Generated by Claude Code |
Resolves a part of #11352.
Description
This pull request:
stats/base/dists/bernoulli/kurtosisfrom relative tolerance testing to ULP difference testing, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.y === expected[i]/delta <= tolbranch in the Julia fixture loops oftest/test.jsandtest/test.native.jswitht.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' );.@stdlib/assert/is-almost-same-valuerequire and drops the now unused@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires.Final ULP constant:
0(used in bothtest/test.jsandtest/test.native.js).This is the measured minimum. The bound was found by measuring the per-fixture ULP difference with
@stdlib/number/float64/base/ulp-differenceacross the full 1000-element Julia fixture set: the largest observed difference is0, i.e., every returned value is bit-identical to its expected value, so no smaller bound exists. Starting from a high bound and lowering it therefore terminates at0. The suite was run twice at the final value with identical results (1009/1009 passing), so there is no FMA/arch variation here.A bound of
0is consistent with already-migrated sibling packages whose fixtures also match exactly — e.g.stats/base/dists/binomial/kurtosis(a464e88), which likewise migrated toisAlmostSameValue( y, expected[ i ], 0 )in both its JS and native test files. The implementation is a single expression,( 1.0/pq ) - 6.0wherepq = p * ( 1.0-p ), andsrc/main.cevaluates the identical expression with the same operation order, so the native add-on is expected to return the same values; the same bound is therefore used in the native test file.Only the two test files are changed.
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
test/test.js→ 1009 passing, 0 failing;test/test.native.jsskips, as the native add-on is not built in this environment. Run twice at the final ULP value to confirm determinism.etc/eslint/.eslintrc.tests.js, including the customstdlibplugin rules) over both changed files and is clean; thepre-commithook's JavaScript test lint also passed.make install-node-modulesfails here becausees-object-atoms@^1.1.2is not published (the reachable registry has at most1.1.1, whilearray-includes@3.2.0and severalstring.prototype.*packages require^1.1.2). This is a pre-existing dependency-resolution failure unrelated to this change; the dependency tree was installed with that transitive version pinned to1.1.1so that the project's own tooling could be used.editorconfig-checkerstep could not execute (its binary is downloaded from GitHub releases, which is unavailable here); both files were verified manually against.editorconfig(LF line endings, tab indentation, no trailing whitespace, final newline).make check-licenses-production) could not run either, as it requires the fullnode_modulestree that the failed install above would have produced. This change adds no dependencies.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. Claude studied #11352 and the already-migrated sibling packages to mirror the established idiom, applied the migration, and determined the ULP bound empirically by measuring the per-fixture ULP difference rather than guessing it.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01FAk9ZwMqUXA4W8o4t7dbtQ
Generated by Claude Code