# Error function¶

erf(x)
Parameters: x (float) – a real scalar.

## Description¶

The integral is

$\mathrm{erf}(x) = \frac{2}{\sqrt{\pi}} \int_0^x \exp(-t^2) dt.$

The magnitude of $$x$$ is limited to $$9.231948545$$ for DEC arithmetic; $$1$$ or $$-1$$ is returned outside this range.

For $$0 <= |x| < 1$$, $$\mathrm{erf}(x) = x * P4(x**2)/Q5(x**2)$$; otherwise $$\mathrm{erf}(x) = 1 - \mathrm{erfc}(x)$$.

## Accuracy¶

Relative error
arithmetic domain # trials peak rms
DEC 0, 1 14000 4.7e-17 1.5e-17
IEEE 0, 1 30000 3.7e-16 1.0e-16