fix: avoid overflow in stats/base/dists/wald/logpdf - #14412
Draft
Planeshifter wants to merge 1 commit into
Draft
Conversation
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.
Description
This pull request:
developbetween 2026-08-18 17:33 PDT (fd16a2f) and 2026-08-19 05:08 PDT (dd78acd). An automated review of the 25 commits in that window (style-guide compliance audit plus two independent bug scans over the union diff) surfaced one validated, high-signal issue.stats/base/dists/wald/logpdf47b5192: the exponent term(lambda*v*v)/(mu*mu*x)overflows before dividing, sologpdf(1.0, 1e155, 1.0)returns NaN andlogpdf(1e155, 1.0, 1.0)returns-Infinityinstead of finite values, violating the documented NaN-only-on-invalid-input contract. Reassociated as((lambda/x)*(v/mu))*(v/mu)inlib/main.js:97,lib/factory.js:83, andsrc/main.c:57; all 100 Julia fixtures still pass at 2 ULP.Related Issues
No.
Questions
No.
Other
Validation performed on the commit window:
docs/style-guidesand established reference packages (e.g., the newstats/base/dists/wald/*packages againststats/base/dists/wald/cdfandstats/base/dists/lognormal/*): no violations found.quantile/logcdf/logpdf/stdevformulas and documented example values numerically, JS↔C parity, and thefromIndexindex-resolution logic inblas/ext/base/ndarray/dfirst-index-less-than. Only the overflow above survived validation.The fix was verified by reproducing the failure on the shipped code, re-running the reassociated implementation, and confirming all 100 Julia fixture cases pass at the tests' 2-ULP tolerance for both
logpdfandlogpdf.factory.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".
This PR was produced by a scheduled automated commit-review run using Claude Code: agents reviewed the last 24 hours of commits merged to
develop, and the fix in this PR was generated and validated by Claude Code. A human maintainer will audit before marking ready for review.Generated by Claude Code