build::libcerf::src::libcerf::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 );

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 (Maclaurin series) and x >= 12 (asymptotic expansion) no theoretical bound exists yet; 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 argument x^2 is rounded before the exponential is taken; the relative error therefore grows like x^2 eps, reaching 32 eps at x = -5.8 and 510 eps at x = -26.3. For x < -26.63 the result overflows.

cerfcx(z) = w(iz) inherits the accuracy of w_of_z(3). 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, the reflection formula of w applies, and the relative error grows in proportion to |z|^2, staying below about 1.6 |z|^2 eps + 5 eps; for instance, 1030 eps were found 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.

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.