.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "build::libcerf::src::libcerf::man::erfcx 3" .TH build::libcerf::src::libcerf::man::erfcx 3 2026-09-05 "perl v5.42.2" "libcerf manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME cerfcx, erfcx \- underflow\-compensated complementary error function .SH SYNOPSIS .IX Header "SYNOPSIS" \&\fB#include .PP \&\fBdouble complex cerfcx ( double complex z );\fR .PP \&\fBdouble erfcx ( double x );\fR .PP The data type \fBdouble complex\fR is defined in the header , 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\*(Aqs C compiler does not support the arithmetic operators for it. As a fallback, use the C++ variant of this library, libcerfcpp, in which \fBdouble complex\fR is replaced by \&\fBstd::complex\fR from the header . .SH DESCRIPTION .IX Header "DESCRIPTION" The function \fBcerfcx\fR is an underflow\-compensated variant of the complex error function: erfcx(z) = exp(z^2) erfc(z). It is a thin wrapper around Faddeeva\*(Aqs function \fBw_of_z\fR(3), which it calls as erfcx(z) = w(iz). .PP The function \fBerfcx\fR takes a real argument and returns a real result. Its implementation is self\-contained. .SH ACCURACY .IX Header "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. .PP For 0.125 <= x < 12, \fBerfcx\fR uses a piecewise Chebyshev approximation generated by \fBppapp\fR, 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. .PP \&\fBcerfcx\fR(z) = w(iz) inherits the accuracy of \fBw_of_z\fR(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. .SH REFERENCES .IX Header "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. .SH "SEE ALSO" .IX Header "SEE ALSO" Related complex error functions in liberfc: \&\fBw_of_z\fR(3), \fBdawson\fR(3), \fBvoigt\fR(3), \fBcerf\fR(3), \fBerfi\fR(3). .PP The real error function comes with recent versions of glibc, as requested by the C99 standard: \&\fBerf\fR(3) .PP Homepage: https://jugit.fz\-juelich.de/mlz/lib/cerf .SH "AUTHORS, REVISION HISTORY, REFERENCE" .IX Header "AUTHORS, REVISION HISTORY, REFERENCE" Until libcerf\-2.4, this was mostly a wrapper of MIT Faddeeva code by Steven G. Johnson. .PP In libcerf\-2.5 of April 2025, the real function erfcx was reimplemented by Joachim Wuttke: .IP \(bu 2 for large |x|, using asymptotic expansions; .IP \(bu 2 for an expanded small |x| range, using Maclaurin series as before; .IP \(bu 2 for intermediate |x|, using piecewise Chebyshev approximation (Wuttke & Kleinsorge, ACM Trans. Math. Softw. 52, 13 (2026), doi:10.1145/3805698). .SH CONTACT .IX Header "CONTACT" Please report bugs to the maintainer: .PP Joachim Wuttke .SH COPYING .IX Header "COPYING" Copyright (c) 2025 Forschungszentrum Juelich GmbH .PP Software: MIT License. .PP This documentation: Creative Commons Attribution Share Alike.