Skip to main content

erfc

Function erfc 

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

Complementary error function erfc(x) = 1 − erf(x) evaluated on the host.

Routes to libm::erfc, the SunOS msun double-precision implementation (accurate to within ~1 ulp across the entire real line). The CUDA kernel side calls device erfc, which is itself msun-derived, so the host CPU reference matches the device path to within a ULP. The previous branchless Cody 1969 Chebyshev rational here was only ~1.2e-7 accurate in relative terms; that ate seven digits of every probit Mills = φ/Φ = pdf / (½·erfc(-x/√2)) evaluation and made any sufficiently tight finite-difference probe of ∂neglog/∂e = -w·s·Mills (which the analytic side computes from this same cdf, while the FD side differences log cdf and cancels the erfc bias) break against itself at the ~2e-7 floor instead of the genuine 5-point-stencil truncation floor near 1e-12.