Complementary error function

erfc(x)

Computes 1 - erf(x) in a numerically stable way.

Parameters:x (float) – a real scalar.

Description

\[1 - \mathrm{erf}(x) = \mathrm{erfc}(x) = \frac{2}{\sqrt{\pi}} \int_x^{\infty} \exp{(-t^2)}dt\]

For small \(x\), erfc(x) = 1 - erf(x); otherwise rational approximations are computed.

A special function expx2() is used to suppress error amplification in computing \(\exp{(-x^2)}\).

Accuracy

  Relative error
arithmetic domain # trials peak rms
IEEE 0, 26.6417 30000 1.3e-15 2.2e-16

Error messages

message condition value returned
erfc underflow x > 9.231948545 (DEC) 0.0

Reference: http://www.netlib.org/cephes/doubldoc.html#erfc