test: migrate stats/base/dists/lognormal/skewness to ULP-based assertions - #15381
Conversation
…rtions Ref: #11352 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nj1i4n5fSMXew7XM8dHy93 --- 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: passed - 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 ReportNo coverage information available. |
|
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 |
Signed-off-by: Athan <kgryte@gmail.com>
Resolves a part of #11352.
Description
This pull request:
stats/base/dists/lognormal/skewnessfrom computed relative-tolerance comparisons (delta = abs( y - expected[ i ] )/tol = 1.0 * EPS * abs( expected[ i ] ), asserted viat.ok( delta <= tol, ... )) to ULP-difference assertions using@stdlib/assert/is-almost-same-value.test/test.jsandtest/test.native.js. Both iterate over the sametest/fixtures/julia/data.jsonfixture (100 points, nonull/skipped entries).if ( y === expected[i] ) { ... } else { ... }branch at each site into a single ULP assertion, and standardizes the assertion message to'returns expected value'.@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires and thedeltaandtolvariable declarations.The remaining assertions in these files are exact comparisons (
NaNpropagation forNaNand non-positivesigma, and function type), which are correct as-is and are left unchanged.Only test files are changed; no implementation, fixture, or documentation changes are included.
ULP bounds
test/test.js1.0 * EPS * abs( expected )0test/test.native.js1.0 * EPS * abs( expected )00is the minimum integer boundNsuch thatisAlmostSameValue( y, expected[ i ], N )holds at every element of the fixture. It was determined by computingskewness( mu[i], sigma[i] )for all 100 fixture points outside the test harness (via bothlib/main.jsand, after building the native add-on withnode-gyp rebuild,lib/native.js) and comparing directly againstexpected[i]using@stdlib/number/float64/base/ulp-difference: the maximum observed ULP difference across the full fixture set was0for both implementations, so a0-ULP (exact) bound is both sufficient and necessary — no looser bound would be tighter.node test/test.jsandnode test/test.native.jswere each run twice at the final bound with identical results on both runs (110/110 and 111/111 assertions passing, respectively), ruling out flakiness on this platform.npx eslintis clean for both changed files.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 resulting diff mirrors the already-merged migrations for sibling distribution packages with the same test structure, e.g.
stats/base/dists/lognormal/mean(#15353) andstats/base/dists/lognormal/mode(#15309).Two environment notes, neither of which affected verification:
make install-node-modulesinitially failed withETARGETfores-object-atoms@^1.1.2. The local npm packument cache was stale and served a filtered view of the registry; afternpm cache clean --force, the install andmake initcompleted and the full toolchain was available for this PR.pre-commithook'slint-editorconfig-filesstep could not run, because it downloads theeditorconfig-checkerbinary from a GitHub release that this environment cannot reach. The commit was made withSKIP_LINT_EDITORCONFIG=1(a flag the hook itself exposes for this purpose), and the changed files were instead checked manually against.editorconfig: tabs for indentation, no trailing whitespace, and a final newline.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written primarily by Claude Code, running as an unattended scheduled task. It selected the package, studied previously migrated packages in the same family to match the established idiom, performed the migration, built the native add-on to verify both implementations empirically, and determined the minimum passing ULP bound over the full fixture set.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01Nj1i4n5fSMXew7XM8dHy93
Generated by Claude Code