Conversation
Replaces the relative-tolerance comparisons (`delta <= tol`) in the fixture loops with `@stdlib/assert/is-almost-same-value` assertions. The ULP bounds are the measured minima over the full fixture sets: `45056` for the both-large fixtures, `20480` for the large `alpha` fixtures, and `13312` for the large `beta` fixtures. The same bounds hold for the JavaScript and native implementations. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Jh65nerjkdreo4WZ75TVj --- 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. |
This branch has not been deployed
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:
@stdlib/stats/base/dists/beta/logpdffrom relative tolerance checks (delta <= tol, computed as<k> * EPS * abs( expected[ i ] )) to ULP-based assertions using@stdlib/assert/is-almost-same-value.test/test.logpdf.js,test/test.factory.js, andtest/test.native.js(the three files containing fixture loops with computed tolerances).test/test.jsonly performs exact comparisons and is left unchanged.@stdlib/math/base/special/absand@stdlib/constants/float64/epsrequires, along with thedeltaandtoldeclarations and they === expected[i]fast-path branch.ULP bounds
The bounds are the measured minima over the full fixture sets (1000 elements each), determined by computing the maximum ULP difference between the actual and expected values for every fixture element:
both_large.json45000.0 * EPS4505645056.large_alpha.json20000.0 * EPS(JS) /22000.0 * EPS(native)2048020480.large_beta.json20000.0 * EPS1331213312; tightened from the previous, looser tolerance.The bounds are large because the fixtures concentrate near the mode, where
logpdfvalues are close to zero and subject to catastrophic cancellation; in absolute terms the largest discrepancy is on the order of5e-15. Each bound is nonetheless equal to or tighter than the relative tolerance it replaces.The same bounds are used in
test.logpdf.js,test.factory.js, andtest.native.js. The native add-on was built locally and measured independently: the C implementation produces the same maxima (45056/20480/13312), so the previously higher nativelarge_alphatolerance was slack rather than a JS/C divergence.Verification
make test TESTS_FILTER=".*/stats/base/dists/beta/logpdf/.*"), and the suite was run twice at the final bounds with identical results (9093 passing assertions, 0 failing).test.native.jswas exercised against a locally built add-on rather than skipped.45055/20479/13311) produces exactly three failures, one per fixture loop.make lint-javascript-tests TESTS_FILTER=".*/stats/base/dists/beta/logpdf/.*"is clean.Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
Other
The inline integer bound idiom (rather than a named
ULPconstant) mirrors the prevailing convention instats/base/dists, where all already-converted test files use inline literals.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code, which surveyed prior converted packages to match the established idiom, applied the test edits, and measured the minimum ULP bounds empirically over the fixture sets for both the JavaScript and native implementations.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_018Jh65nerjkdreo4WZ75TVj
Generated by Claude Code