---
name: "erfcx"
section: "3"
platform: "linux"
package: "libcerf"
version: "1:3.9-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/erfcx"
---

# erfcx(3)

underflow-compensated complementary error function

## NAME

cerfcx, erfcx - underflow-compensated complementary error function

## SYNOPSIS

**#include \<cerf.h**\>

**double complex cerfcx ( double complex z );**

**double          erfcx  ( double x );**

The data type **double complex** is defined in the header \<complex.h\>, which C99 introduced. Since C11 it is optional: an implementation may define \_\_STDC\_NO\_COMPLEX\_\_ and then provide neither the header nor the type, and Microsoft's C compiler does not support the arithmetic operators for it. As a fallback, use the C++ variant of this library, libcerfcpp, in which **double complex** is replaced by **std::complex\<double\>** from the header \<complex\>.

## DESCRIPTION

The function **cerfcx** is an underflow-compensated variant of the complex error function: erfcx(z) = exp(z^2) erfc(z). It is a thin wrapper around Faddeeva's function [**w\_of\_z**(3)](/w_of_z/3.md), which it calls as erfcx(z) = w(iz).

The function **erfcx** takes a real argument and returns a real result. Its implementation is self-contained.

## ACCURACY

Errors are given in units of eps = 2^-53 = 1.1e-16, as relative deviations from high-precision reference values; for complex results, of the modulus.

For 0.125 \<= x \< 12, **erfcx** uses a piecewise Chebyshev approximation generated by **ppapp**, whose error analysis (Wuttke and Kleinsorge, ACM Trans. Math. Softw. 52, 13, 2026) bounds the relative error by 2.1 eps. For 0 \<= x \< 0.125 the Maclaurin series is used and for x \>= 12 the asymptotic expansion; for neither has a complete bound been written down yet, although both series alternate with decreasing terms, so that their truncation error is bounded by the first term omitted. The relative error was found below 2.1 eps. For x \< 0, erfcx(x) = 2 exp(x^2) - erfcx(-x) is dominated by the exponential, whose exponent x^2 is carried as an unevaluated sum of two doubles; the relative error was found below 2.6 eps. For x \< -26.63 the result overflows.

**cerfcx**(z) = w(iz) inherits the accuracy of [**w\_of\_z**(3)](/w_of_z/3.md), the rotation by a right angle being exact. For Re z \>= 0, the relative error of the modulus is bounded by 3 eps for \|z\| \< 7 and by 5.2 eps for \|z\| \>= 7. For Re z \< 0, erfcx(z) = 2 exp(z^2) - erfcx(-z) is used, with the exponent carried as an unevaluated sum of two doubles; the two terms may cancel, and the error is not controlled. Near the zeros of erfcx, the first pair of which lies at z = -1.3548 +- 1.9915i, the relative error is unbounded. An improved implementation is under preparation.

## REFERENCES

Joachim Wuttke, "libcerf, complex error function and related functions reimplemented with relative accuracy guarantees" (unpublished manuscript, available upon request) documents the algorithms of this library and derives their error bounds.

## SEE ALSO

Related complex error functions in liberfc: [**w\_of\_z**(3)](/w_of_z/3.md), [**dawson**(3)](/dawson/3.md), [**voigt**(3)](/voigt/3.md), [**cerf**(3)](/cerf/3.md), [**erfi**(3)](/erfi/3.md).

The real error function comes with recent versions of glibc, as requested by the C99 standard: [**erf**(3)](/erf/3.md)

Homepage: https://jugit.fz-juelich.de/mlz/lib/cerf

## AUTHORS, REVISION HISTORY, REFERENCE

Until libcerf-2.4, this was mostly a wrapper of MIT Faddeeva code by Steven G. Johnson.

In libcerf-2.5 of April 2025, the real function erfcx was reimplemented by Joachim Wuttke:

- •

  for large \|x\|, using asymptotic expansions;

- •

  for an expanded small \|x\| range, using Maclaurin series as before;

- •

  for intermediate \|x\|, using piecewise Chebyshev approximation (Wuttke & Kleinsorge, ACM Trans. Math. Softw. 52, 13 (2026), doi:10.1145/3805698).

## CONTACT

Please report bugs to the maintainer:

Joachim Wuttke \<j.wuttke@fz-juelich.de\>

## COPYING

Copyright (c) 2025 Forschungszentrum Juelich GmbH

Software: MIT License.

This documentation: Creative Commons Attribution Share Alike.
