Skip to content

Decide and enforce the ±inf input contract for pdf/logpdf/cdf #103

Description

@OldCrow

Found by the #46 characterization sweep (PR #101; docs/ACCURACY_CHARACTERIZATION.md, Findings + appendix).

Current behavior is three different conventions at once:

  • gamma, chi-squared, rayleigh, weibull scalar pdf/logpdf return NaN at +inf, where the mathematical limits exist (pdf → 0, logpdf → -inf);
  • chi-squared/gamma batch logpdf(+inf) returns the clamp constant −4605.0 (ln(1e-2000)), disagreeing with their own scalar paths;
  • von Mises applies a consistent saturation convention in both paths (pdf → 0, logpdf → -inf, cdf → 0/1) — defensible for a periodic distribution where no limit exists.

Decision needed first (this is a policy issue, not just a bug): return the mathematical limit where one exists (recommended — matches cdf behavior, which already returns 0/1 at ∓inf), or document NaN-for-inf as the contract. Either way scalar and batch must agree; the −4605.0 clamp leaking out of a log-space kernel should not survive in any option.

Unmilestoned pending that decision; the enforcement change is small once made.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions