Error Functions and Normal Distribution.
Stephen L. Moshier, ported to D by Don Clugston
- real erfc(real a) ¶
-
Complementary error function
erfc(x) = 1 - erf(x), and has high relative accuracy for
values of x far from zero. (For values near zero, use erf(x)).
1 - erf(x) = 2/ √(π)
∫ exp( - t
2) dt
For small x, erfc(x) = 1 - erf(x); otherwise rational
approximations are computed.
A special function expx2(x) is used to suppress error amplification
in computing exp(-x^2).
- real erf(real x) ¶
-
The integral is
erf(x) = 2/ √(π)
∫ exp( - t
2) dt
The magnitude of x is limited to about 106.56 for IEEE 80-bit
arithmetic; 1 or -1 is returned outside this range.
For 0 <= |x| < 1, a rational polynomials are used; otherwise
erf(x) = 1 - erfc(x).
Relative error:
arithmetic domain # trials peak rms
IEEE 0,1 50000 2.0e-19 5.7e-20