Goal
As a user calling .q(p) on Gamma or InverseGamma with extreme shape parameters (alpha ~ 0.01–0.02) and p very close to 0 or 1, the quantile should converge to a finite correct value instead of silently returning NaN.
Scope
src/dist/gamma.js
src/dist/inverse-gamma.js
The closed-form _q(p) implementations.
Acceptance Criteria
new dist.Gamma(0.01256450685433316, 8.836044349967338).q(3.6121091725799824e-6) returns a finite value (not NaN)
new dist.InverseGamma(0.01015699205818355, 50.384930286066414).q(0.9999928271253562) returns a finite value (not NaN)
- The two additional Gamma small-alpha NaN cases surfaced by the sweep also resolve to finite values
- Round-trip
|cdf(q(p)) - p| for Gamma/InverseGamma passes the harness's non-convergence hard-failure check (scripts/difftest-quantile.py) across the extended tail sweep
- No regression in existing Gamma/InverseGamma precision-gate reference values
Out of Scope
General closed-form quantile redesign for all alpha ranges — only the extreme small-alpha near-boundary-p regime identified by this sweep.
How found
Discovered by the new quantile accuracy sweep added in #1269 (scripts/difftest-quantile.py). new dist.Gamma(0.01256..., 8.836...).q(3.612e-6) and new dist.InverseGamma(0.01016..., 50.385...).q(0.99999...) both return NaN, plus two additional confirmed Gamma small-alpha NaN cases — a hard non-convergence failure in the closed-form formulas.
Goal
As a user calling
.q(p)onGammaorInverseGammawith extreme shape parameters (alpha~ 0.01–0.02) andpvery close to 0 or 1, the quantile should converge to a finite correct value instead of silently returningNaN.Scope
src/dist/gamma.jssrc/dist/inverse-gamma.jsThe closed-form
_q(p)implementations.Acceptance Criteria
new dist.Gamma(0.01256450685433316, 8.836044349967338).q(3.6121091725799824e-6)returns a finite value (not NaN)new dist.InverseGamma(0.01015699205818355, 50.384930286066414).q(0.9999928271253562)returns a finite value (not NaN)|cdf(q(p)) - p|for Gamma/InverseGamma passes the harness's non-convergence hard-failure check (scripts/difftest-quantile.py) across the extended tail sweepOut of Scope
General closed-form quantile redesign for all
alpharanges — only the extreme small-alphanear-boundary-pregime identified by this sweep.How found
Discovered by the new quantile accuracy sweep added in #1269 (
scripts/difftest-quantile.py).new dist.Gamma(0.01256..., 8.836...).q(3.612e-6)andnew dist.InverseGamma(0.01016..., 50.385...).q(0.99999...)both returnNaN, plus two additional confirmed Gamma small-alpha NaN cases — a hard non-convergence failure in the closed-form formulas.