Table of Contents
Fetching ...

Global approximations to the error function of real argument for vectorized computation

Dimitri N. Laikov

TL;DR

This work delivers two global closed-form approximations for the real-argument error function $\mathrm{erf}(x)$ (and the related $\mathrm{erf}(x)/x$) that are valid across the entire domain using only standard arithmetic and square roots, optionally augmented by $e^{-s}$. By transforming $\mathrm{erf}$ through $\phi(s)$ and $\psi(s)$ and enforcing boundary and asymptotic constraints, the authors construct rational approximations that can be raised to the power $2^K$ to achieve high precision, up to $128$ bits, with two variants: an exponential-based form and an exponential-free form. Coefficients are computed with multi-precision arithmetic and implemented in a C routine named "erf25" that supports serial and vectorized evaluation, delivering competitive or superior performance to standard library routines on modern CPUs and enabling efficient SIMD usage for large-scale simulations. The provided coefficients and code (erf25) are publicly available, facilitating ultra-fast, high-precision erf evaluations in vectorized numerical workflows.

Abstract

The error function of real argument can be uniformly approximated to a given accuracy by a single closed-form expression for the whole variable range either in terms of addition, multiplication, division, and square root operations only, or also using the exponential function. The coefficients have been tabulated for up to 128-bit precision. Tests of a computer code implementation using the standard single- and double-precision floating-point arithmetic show good performance and vectorizability.

Global approximations to the error function of real argument for vectorized computation

TL;DR

This work delivers two global closed-form approximations for the real-argument error function (and the related ) that are valid across the entire domain using only standard arithmetic and square roots, optionally augmented by . By transforming through and and enforcing boundary and asymptotic constraints, the authors construct rational approximations that can be raised to the power to achieve high precision, up to bits, with two variants: an exponential-based form and an exponential-free form. Coefficients are computed with multi-precision arithmetic and implemented in a C routine named "erf25" that supports serial and vectorized evaluation, delivering competitive or superior performance to standard library routines on modern CPUs and enabling efficient SIMD usage for large-scale simulations. The provided coefficients and code (erf25) are publicly available, facilitating ultra-fast, high-precision erf evaluations in vectorized numerical workflows.

Abstract

The error function of real argument can be uniformly approximated to a given accuracy by a single closed-form expression for the whole variable range either in terms of addition, multiplication, division, and square root operations only, or also using the exponential function. The coefficients have been tabulated for up to 128-bit precision. Tests of a computer code implementation using the standard single- and double-precision floating-point arithmetic show good performance and vectorizability.

Paper Structure

This paper contains 5 sections, 18 equations, 2 tables.