Skip to content

erf

erf(x): number

Defined in: packages/math-analysis/src/erf.ts:29

The error function erf(x) = 2/√π ∫₀ˣ e^(−t²) dt — how much of a bell curve lies within a given distance of its centre.

Concretely: erf(x) is the probability that a standard normal measurement lands within x√2 of its mean. It is what turns “three sigma” into a number, and it is the building block of every normal-distribution tail probability.

Reach for erfc whenever the answer is near 1. erf saturates to exactly 1 at about x = 6, so 1 - erf(x) past that point returns zero rather than a small number, and the quantity you wanted is gone.

O(1) time, O(1) memory in the sense that matters to a caller: the underlying expansion is iterative but bounded, and allocates nothing.

number

Any real.

number

erf(x), in [−1, 1].

erf(1); // 0.8427007929497148 — ~84% within one √2-sigma
erf(6); // 1 — saturated; use erfc past here
```;
## See
- [erfc](erfc.md) for the complement, and for tail probabilities.
- [The error function](https://anthochamp.pages.grenadine.io/node-essentials/topics/math/functions/error-functions/)