One λ_j · χ²_{h_j} term of a linear combination of independent
chi-squares, with the weight’s SIGN and the term’s degrees of freedom both
carried explicitly.
Default absolute accuracy weighted_chi_square_sf certifies on its Imhof
truncation. It is four orders below the smallest probability any consumer
of a survival function resolves in practice and eleven below one, so the
truncation is never the term that limits a reported tail.
Quantile (inverse CDF) of a Beta distribution with shape parameters a > 0
and b > 0 at probability p: the value x in [0, 1] with
I_x(a, b) = p, where I is the regularized incomplete beta.
cone_boundary_log_factor together with its exact partial derivatives
in the standardized arguments — the pieces the outer ρ-gradient chains
through (μ̃, h̃, s)(ρ) (gam#2306 §4 “the g-factors differentiate in
closed form”). With ξ = b − a and the Mills ratio λ(ξ) = φ(ξ)/Φ(ξ):
Numerically stable ln Φ(x) for the standard normal CDF. For x ≥ 0,
evaluates ln(1 - 0.5 erfc(x/sqrt(2))) with ln_1p, retaining the small
negative result after Φ(x) itself rounds to one. For x < 0, rewrites
ln Φ(x) = −u² + ln(½·erfcx(u)), u = −x/√2,
which preserves digits throughout the representable left tail without a
probability floor. Returns the corresponding IEEE limit at infinities and
propagates NaN.
Numerically stable ln(1 − Φ(x)) = ln Φ(−x) for the standard normal
survival function. Delegates to normal_logcdf(-x) so the deep-right
tail benefits from the same erfcx-based representation.
Numerically stable signed log-sum-exp. Given pairs
(log|aⱼ|, sign(aⱼ)) (with signs[j] ∈ {−1, 0, +1}), returns
(log|S|, sign(S)) for S = Σⱼ signs[j]·exp(log_mags[j]). Positive
and negative magnitudes are first reduced together, after one common
log-space rescaling, with a twofold compensated sum. This avoids rounding
each same-sign subtotal through ln and exp before subtracting them — an
avoidable loss that is amplified in cancellation-conditioned derivative
cumulants. If the compensated residual lies inside its forward-error bound,
the function instead uses the two-subtotal log-domain difference
log(|p − n|) = max(log p, log n) + log1mexp(|log p − log n|). That branch retains differences between two input
logs even when their exponentials round to the same f64. When all signs are
zero or all magnitudes are −∞, returns (NEG_INFINITY, 0.0).
Joint evaluation of ln Φ(x) and the Mills-ratio analogue
φ(x) / Φ(x), signed for the symmetric branch. Used by the latent
probit families where the inverse-link gradient needs the ratio and
the likelihood needs the log-CDF on the same x; computing both in
one call shares the erfcx evaluation that dominates the cost in the
deep tail.
Survival probability P(Σ_j λ_j χ²_{h_j} > statistic) for independent
central chi-squares, with weights of EITHER SIGN, at
WEIGHTED_CHI_SQUARE_TOLERANCE.
weighted_chi_square_sf together with the certified absolute bound on its
own truncation error, so a consumer (or a test) can see the accuracy rather
than trust it.