erfc
erfc(
x):number
Defined in: packages/math-analysis/src/erfc.ts:33
The complementary error function erfc(x) = 1 − erf(x) — how much of a bell
curve lies beyond a given distance from its centre.
This is the one you want for a tail probability, a p-value, or any “how
unlikely is this?” question. It is not a convenience wrapper: computing it as
1 - erf(x) loses the entire answer once erf(x) rounds to 1, from about x = 6. Computed directly, it keeps full relative precision down to the
underflow limit near x = 26.5, which is what makes a normal tail
probability of 1e-100 computable at all.
The rule generalises across this package: reach for the upper form when the answer is small.
O(1) time, O(1) memory in the sense that matters to a caller: the underlying expansion is iterative but bounded, and allocates nothing.
Parameters
Section titled “Parameters”number
Any real.
Returns
Section titled “Returns”number
erfc(x), in [0, 2].
Example
Section titled “Example” erfc(6); // 2.1519736712498916e-17 1 - erf(6); // 0 — the same quantity, computed the wrong way erfc(20); // 5.395865611607905e-176 ```;
## See
- [erf](erf.md) when the answer is near 0 rather than near 1. - [The error function](https://anthochamp.pages.grenadine.io/node-essentials/topics/math/functions/error-functions/)