cerfcx, erfcx - underflow-compensated complementary error function
#include <cerf.h>
double _Complex cerfcx ( double _Complex z );
double erfcx ( double x );
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. For 0.03 < x < 12, its relative error stays below 2.2 eps = 2.4e-16, which auto-generated test cases verify at 1008 sample points.
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
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).
Please report bugs to the maintainer:
Joachim Wuttke <j.wuttke@fz-juelich.de>
Copyright (c) 2025 Forschungszentrum Juelich GmbH
Software: MIT License.
This documentation: Creative Commons Attribution Share Alike.