Advertisement
Advertisement
SPECIAL FUNCTIONS

Error Function Calculator — erf, erfc and both inverses

Evaluate the error function, the complementary error function and their inverses to full double precision, including the deep tail where a naive series loses every digit.

Any real number. erf is odd, so erf(−x) = −erf(x), and the tool exploits that rather than recomputing.
erf inverse needs −1 < p < 1; erfc inverse needs 0 < p < 2. Values outside those ranges are reported as undefined.
Display only. Everything is computed at full double precision, which is about 16 significant digits.
erf(x)
 
erfc(x)
Normal CDF Φ(x)
erf⁻¹(p)
erfc⁻¹(p)
Related values:
Method:
Tip: never compute erfc(x) as 1 − erf(x) for large x. At x = 6 the true value is about 2.15 × 10⁻¹⁷, and subtracting from one in double precision leaves nothing but rounding noise.
Advertisement

The error function calculator above evaluates erf(x), its complement erfc(x) = 1 − erf(x), and both inverse functions, along with the standard normal cumulative distribution Φ(x) that is built from them. It computes erfc directly rather than by subtraction, which is the difference between a correct answer and zero once x passes about six.

The error function is the integral of the Gaussian, normalised so that it runs from −1 to 1. It turns up wherever a normal distribution, a diffusion process or a heat conduction problem does. Arb Digital publishes this page as the function itself, at full precision, across the whole real line. If you want probabilities from a normal distribution with a given mean and standard deviation, our normal distribution calculator is the right page — erf is what sits underneath its cumulative probabilities, and this page exposes it directly.

What This Error Function Calculator Does

It returns four related quantities at once. erf(x) is the headline. erfc(x) is its complement, computed by its own algorithm so that tail values stay accurate to full relative precision instead of collapsing to zero. Φ(x) is the standard normal cumulative distribution, obtained from erf by the exact identity relating the two. And the two inverse functions answer the reverse question: what argument produces a given value.

Small values are displayed in scientific notation automatically, because that is the only way to show a tail probability honestly. A value of 2.15 × 10⁻¹⁷ displayed as 0.0000000000 is not a rounding choice, it is a wrong answer, and the deep-tail button is there so you can confirm the tool does not make it.

The inverse functions take a separate input, because they operate on a probability rather than on an argument. erf inverse is defined for arguments strictly between −1 and 1; erfc inverse for arguments strictly between 0 and 2. Outside those ranges the tool says the value is undefined rather than returning an infinity or a NaN.

How to Use It

  1. Enter the argument x. Any real value, positive or negative, of any magnitude.
  2. Enter a separate probability p if you want the inverse functions; it is independent of x.
  3. Read erf and erfc in the hero and the grid, with the normal CDF alongside for the statistical reading.
  4. Raise the decimals shown up to fifteen if you are checking against a published table.
  5. Use the tail preset to confirm that erfc stays meaningful where one minus erf would not.

The Definition and How It Is Computed

The error function is defined by the integral

erf(x) = (2 ÷ √π) ∫0x e−t² dt

and the complementary error function is erfc(x) = 1 − erf(x), which has its own integral from x to infinity. The NIST Digital Library of Mathematical Functions gives both in §7.2 Definitions of its chapter on error functions, together with the related Dawson and Fresnel integrals. The normalisation is chosen so that erf(∞) = 1 exactly.

There is no elementary closed form, so it must be computed by series. This tool uses the incomplete gamma representation: for x ≥ 0, erf(x) is the regularised lower incomplete gamma function P(½, x²) and erfc(x) is the upper one, Q(½, x²). The lower function is evaluated by its ascending series where x² is small, and the upper by its continued fraction where x² is large, with the crossover chosen so that whichever is used is the rapidly converging one. Wolfram MathWorld's pages on erf and erfc give the series expansions and the asymptotic behaviour.

Some reference values to check against: erf(0.5) = 0.5204998778, erf(1) = 0.8427007929, erf(2) = 0.9953222650 and erf(3) = 0.9999779095. The complements are erfc(2) = 0.0046777350 and erfc(3) = 2.209050 × 10⁻⁵. On the inverse side, erf⁻¹(0.5) = 0.4769362762. Enter each and confirm the digits agree.

Advertisement

Why erfc Is a Separate Function

This is the practical heart of the page. Mathematically erfc(x) is just 1 − erf(x), so it looks redundant. Numerically it is nothing of the sort.

At x = 4, erf(x) = 0.9999999846, so 1 − erf(x) = 1.54 × 10⁻⁸. Double precision holds about sixteen significant digits, so subtracting a number that close to one from one leaves roughly eight meaningful digits — half the precision has gone. At x = 6, erf(x) rounds to exactly 1.0 in double precision, and 1 − erf(x) returns exactly zero, while the true erfc(6) is about 2.15 × 10⁻¹⁷. The answer is not merely imprecise, it is wrong by an infinite factor.

Computing erfc through its own continued fraction avoids the subtraction entirely and holds full relative accuracy down to about 10⁻³₀₀, where the exponent range of a double finally runs out. Any tail probability, any reliability calculation, any statement about a six-sigma event depends on this. Our z-score calculator and p-value calculator both live in that territory.

The Link to the Normal Distribution

The standard normal cumulative distribution is related to the error function by a substitution and a shift:

Φ(x) = ½(1 + erf(x ÷ √2)) and equivalently Φ(x) = ½ erfc(−x ÷ √2)

The factor of √2 is the only real subtlety, and it is the most common source of error when moving between statistical and mathematical references. The error function integrates e−t², while the normal density integrates e−t²/2; the two differ by a scaling of the variable by √2. Substituting z where x ÷ √2 belongs gives an answer that looks reasonable and is quietly wrong.

The second identity, using erfc, is the one to use for upper tails, for the reason set out above. A two-sided normal p-value is erfc(|z| ÷ √2) exactly, with no subtraction anywhere, which is why that expression appears in well-written statistical software. The inverse direction gives critical values: our inverse normal distribution calculator and confidence interval calculator both need erf inverse to produce a z for a stated confidence level.

Where the Function Comes From

The name is misleading in a way worth clearing up. The error function has nothing to do with numerical error or with mistakes. It comes from the nineteenth-century theory of errors of observation, where the Gaussian was the assumed distribution of measurement error, and the integral of that distribution acquired the name.

Its other homes are physical. The solution to the one-dimensional heat equation on a half-line with a step initial condition is an error function of position divided by the square root of time, and the same expression solves the diffusion equation for a concentration front. That is why erf appears throughout heat transfer, doping profiles in semiconductor fabrication, and contaminant transport in groundwater.

It is also intimately tied to the gamma function, since erf is a scaled incomplete gamma function at the half-integer parameter one half, and Γ(½) = √π is precisely the constant that appears in its normalisation. Our gamma function calculator evaluates that function directly, and the shared appearance of √π in both is not a coincidence but the same integral seen twice.

Need a calculator that holds precision in the tail?

Arb Digital builds free tools that pick the algorithm to suit the argument instead of using one formula everywhere.

Browse All Free Tools Talk To Our Team

Common Mistakes to Avoid

  • Computing erfc as one minus erf — it loses half the precision by x = 4 and returns exactly zero by x = 6, where the true value is far from zero.
  • Forgetting the √2 when converting to a normal probability — erf integrates e to the minus t squared, the normal density integrates e to the minus t squared over two.
  • Using the Taylor series for large arguments — the alternating terms grow to enormous size before cancelling, and double precision cannot survive the cancellation.
  • Passing an out-of-range argument to the inverse — erf inverse is undefined at and beyond plus or minus one, where the function is asymptotic rather than attained.
  • Assuming erf is available in a language's standard maths library — many, including JavaScript, do not provide it, which is why it has to be implemented rather than called.

Related Free Tools From Arb Digital

Get probabilities for a normal distribution with the normal distribution calculator, invert one with the inverse normal distribution calculator, standardise an observation with the z-score calculator, convert a statistic to a tail probability with the p-value calculator, build an interval with the confidence interval calculator, or evaluate the related special function with the gamma function calculator. The full free online tools hub lists every mathematics tool we publish.

Frequently Asked Questions

What is the error function?

It is the integral of the Gaussian from zero to x, scaled by two over the square root of pi so that it runs from minus one to one. It has no elementary closed form and must be computed by series.

Why is erfc computed separately?

Because one minus erf loses half its significant digits by x equals four and returns exactly zero by x equals six, where the true complementary value is about two times ten to the minus seventeen.

How does erf relate to the normal distribution?

The standard normal cumulative distribution equals one half times one plus erf of x divided by the square root of two. That square root of two is the most commonly dropped factor in the conversion.

What algorithm does this tool use?

The incomplete gamma representation, with an ascending series for small arguments and a continued fraction for large ones, so that whichever branch is used is the rapidly converging one.

What is the range of the inverse functions?

erf inverse is defined strictly between minus one and one, and erfc inverse strictly between zero and two. At the endpoints the functions are asymptotic, so no finite argument produces them.

Is the error function related to errors or mistakes?

No. The name comes from the nineteenth-century theory of errors of observation, where the Gaussian described measurement error. It has nothing to do with numerical error.

Where does the error function appear in physics?

In diffusion and heat conduction. A step initial condition on a half-line evolves into an error function of position divided by the square root of time, which is why it appears throughout heat transfer and semiconductor doping.

How accurate are the values shown?

Close to full double precision, which is about fifteen to sixteen significant digits. They match the standard published tables of the function to every digit those tables carry.

This page evaluates a mathematical special function for educational purposes. Results are computed in double-precision floating point, so the final one or two displayed digits may differ from an arbitrary-precision reference.

Advertisement
Advertisement

Take it further