Skip to main content

normal_logcdf

Function normal_logcdf 

Source
pub fn normal_logcdf(x: f64) -> f64
Expand description

Numerically stable ln Φ(x) for the standard normal CDF. Implementation lives in gam-math; re-exported to keep crate::probability::normal_logcdf resolving for all existing callers. 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.