mnt::share::cygpkgs::libcerf::libcerf.x86_64::src::libcerf-3.7::man::erfcx(3)

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), 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; the largest deviation found at the 624 generated test points in this range is 1.7 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 at 1008 generated test points for 0.03 <= x < 48 and at 30000 random points with x up to 1e50. 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 at 2000 random points with 0.2 < |x| < 26.3. Before libcerf-3.7 the square was rounded into a single double, and the error grew like x^2 eps, reaching 511 eps at x = -26.1. For x < -26.63 the result overflows.

cerfcx(z) = w(iz) inherits the accuracy of w_of_z(3), 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 was found below 4.4 eps for 7 <= |z| < 14. 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, so that the relative error stays below 5.5 eps whatever |z|; before libcerf-3.7 it grew in proportion to |z|^2, reaching 1030 eps at |z| = 26. Near the zeros of erfcx, the first pair of which lies at z = -1.3548 +- 1.9915i, cancellation amplifies the relative error without bound.

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), dawson(3), voigt(3), cerf(3), erfi(3).

The real error function comes with recent versions of glibc, as requested by the C99 standard: erf(3)

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.