You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found during v2.4.0 #57 (TruncatedNormal), documented in-tree, deliberately not patched there
Two defects in detail::erf_inv:
Extreme-tail band is badly wrong and non-monotone: erf_inv(1−1e-14) returns 7.59 where the true value is 5.46. Root cause: the extreme-tail seed is a Φ⁻¹-domain formula never converted to the erf domain, and the Halley refinement cannot recover once std::erf saturates to 1 (the residual becomes constant in x).
Small-argument relative floor ~1.4e-8: Halley iteration stops on an ABSOLUTE 1e-12 tolerance, so small outputs carry ~1.4e-8 relative error.
Blast radius: GaussianDistribution::getQuantile shares the defect for p ≳ 1−1e-9 (upper tail); by symmetry the deep lower tail of the complement path. TruncatedNormal (#57) and HalfNormal work around it locally (survival-domain solver / Newton polish on the erfc residual — see src/truncated_normal.cpp, which contains a working reference approach). Beta/F quantiles are unaffected (different machinery).
Contract relevance: #104's finite-best-effort quantile contract promises per-family documented accuracy — a non-monotone 39%-error band is outside any documentable budget.
If not absorbed: port the survival-domain approach already proven in truncated_normal.cpp (AS 26.2.23 seed + Newton on the erfc residual), and make the Halley stop relative.
Regression gate must be shown to fail against the current implementation (AGENTS.md rule): monotonicity across the band + reference values at p = 1−1e-10 … 1−1e-15.
Related: the same #57 work found detail::inverse_beta_i similarly quantile-limited (separate issue).
Found during v2.4.0 #57 (TruncatedNormal), documented in-tree, deliberately not patched there
Two defects in
detail::erf_inv:std::erfsaturates to 1 (the residual becomes constant in x).Blast radius:
GaussianDistribution::getQuantileshares the defect for p ≳ 1−1e-9 (upper tail); by symmetry the deep lower tail of the complement path. TruncatedNormal (#57) and HalfNormal work around it locally (survival-domain solver / Newton polish on the erfc residual — seesrc/truncated_normal.cpp, which contains a working reference approach). Beta/F quantiles are unaffected (different machinery).Contract relevance: #104's finite-best-effort quantile contract promises per-family documented accuracy — a non-monotone 39%-error band is outside any documentable budget.
Suggested remedy path
erfinvcore absorbs this outright — erfinv is explicitly named in the adoption case (see PLAN.md corvus staging entry). If absorbed, close via the adoption change set, same pattern as accuracy(special-functions): beta_i loses ~1e-6 absolute at b >= 1e9 -- lgamma cancellation in the log-beta prefix #126.truncated_normal.cpp(AS 26.2.23 seed + Newton on the erfc residual), and make the Halley stop relative.Related: the same #57 work found
detail::inverse_beta_isimilarly quantile-limited (separate issue).🤖 Generated with Claude Code