Skip to main content

erfc

Function erfc 

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

Complementary error function, erfc(x) = 1 - erf(x).

Chebyshev-coefficient form (Numerical Recipes, 3rd ed., section 6.2.2, the Erf struct’s erfccheb), valid for any nonnegative z via the substitution `t = 2 / (2

  • z), which maps [0, infinity)onto(0, 1] -- so the same 28-term expansion covers the whole range without a separate small-x/large-xsplit. Negative arguments use the exact identityerfc(-x) = 2 - erfc(x)`.

Accurate to a couple of ULP of the true double-precision result across the whole range (see this module’s tests: the Abramowitz & Stegun Table 7.1 values, a denser libm cross-check out to x = 6, and the far tail at x = 6/sqrt(2) used by normal_cdf(-6.0)). erfc(NAN) is NAN; erfc(INFINITY) is 0.0; erfc(NEG_INFINITY) is 2.0.