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

# erfi(3)

imaginary error function

## NAME

cerfi, erfi - imaginary error function

## SYNOPSIS

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

**double complex cerfi ( double complex z );**

**double         erfi  ( 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 **cerfi** returns an error function rotated in the complex plane, erfi(z) = -i erf(iz).

The function **erfi** takes a real argument and returns a real result.

## 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.

**erfi**(x) = exp(x^2) Im w(x) is computed from [**im\_w\_of\_x**(3)](/im_w_of_x/3.md), with the exponent x^2 carried as an unevaluated sum of two doubles; the relative error was found below 4.7 eps for 0.2 \< x \< 26.3. The exponential alone overflows from \|x\| = 26.6417 on; since Im w(x) \< 1/(sqrt(pi) x) brings the product back into range, a constant is split off the exponent there, so that the full range of erfi is available and +-Inf is returned only from \|x\| = 26.7140 on, where erfi itself exceeds the double format.

**cerfi**(z) = -i erf(iz) inherits the accuracy of [**cerf**(3)](/cerf/3.md), the rotation by a right angle being exact: the error is not controlled, the relative error is unbounded near the zeros of erfi, the first of which lie at z = +-1.8809 +- 1.4506i, and it reaches about 120 eps close to the origin, for 0.01 \< \|z\| \< 0.1 off the coordinate axes, where the Maclaurin series is not used.

## 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

The implementation of **cerfi** and **erfi** is trivially based on the functions [**cerf**(3)](/cerf/3.md) and [**im\_w\_of\_x**(3)](/im_w_of_x/3.md).

Other complex error functions in libcerf: [**dawson**(3)](/dawson/3.md), [**erfcx**(3)](/erfcx/3.md), [**voigt**(3)](/voigt/3.md), [**w\_of\_z**(3)](/w_of_z/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

Steven G. Johnson, Massachusetts Institute of Technology,\
   wrote this function as part of the MIT Faddeeva package.

Joachim Wuttke, Forschungszentrum Juelich,\
   reorganized the code into a library, and wrote this man page.

## CONTACT

Please report bugs to the maintainer:

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

## COPYING

Copyright (c) 2012 Massachusetts Institute of Technology

Copyright (c) 2013 Forschungszentrum Juelich GmbH

Software: MIT License.

This documentation: Creative Commons Attribution Share Alike.
