Skip to main content

erf

Function erf 

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

Compute the error function erf(x) using the Abramowitz & Stegun approximation.

Maximum error: |ε| < 1.5 × 10⁻⁷

§Examples

use batuta_common::math::erf;
assert!((erf(0.0) - 0.0).abs() < 1e-6);
assert!((erf(1.0) - 0.842_700_8).abs() < 1e-5);
assert!((erf(-1.0) + 0.842_700_8).abs() < 1e-5);