test: migrate stats/base/dists/lognormal/mode to ULP-based assertions - #15309
Merged
Merged
Conversation
Ref: #11352 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KaEmx8PGodkbJvH7CcTJpR --- 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 ---
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
kgryte
reviewed
Sep 18, 2026
kgryte
reviewed
Sep 18, 2026
kgryte
reviewed
Sep 18, 2026
kgryte
reviewed
Sep 18, 2026
kgryte
reviewed
Sep 18, 2026
kgryte
reviewed
Sep 18, 2026
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
kgryte
approved these changes
Sep 18, 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/lognormal/modefrom computed relative-tolerance comparisons (delta = abs( y - expected[ i ] )/tol = N * 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 (110 points, somenull/skipped).if ( y === expected[i] ) { ... } else { ... }branch at each site into a single ULP assertion via a namedULPconstant, 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.js18.0 * EPS * abs( expected )00is the minimum integer boundNsuch thatisAlmostSameValue( y, expected[ i ], N )holds at every non-nullelement of the fixture. It was determined by computingmode( mu[i], sigma[i] )for all 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 "mean"/"mode" packages with the same test structure, e.g.
stats/base/dists/f/mean(#15233) andstats/base/dists/hypergeometric/mean(#15235).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_01KaEmx8PGodkbJvH7CcTJpR
Generated by Claude Code