s Chapter Contents
s Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_erfc (s15adc)

## 1  Purpose

nag_erfc (s15adc) returns the value of the complementary error function, $\mathrm{erfc}x$.

## 2  Specification

 #include #include
 double nag_erfc (double x)

## 3  Description

nag_erfc (s15adc) calculates an approximate value for the complement of the error function
 $erfc⁡x = 2 π ∫ x ∞ e - u 2 du = 1 - erf⁡x .$
The approximation is based on a Chebyshev expansion.

## 4  References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications

## 5  Arguments

1:     xdoubleInput
On entry: the argument $x$ of the function.

None.

## 7  Accuracy

If $\delta$ and $\epsilon$ are relative errors in the argument and result, respectively, then in principle $\left|\epsilon \right|\simeq \left|\left(2{xe}^{-{x}^{2}}/\sqrt{\pi }\mathrm{erfc}x\right)\delta \right|$, so that the relative error in the argument, $x$, is amplified by a factor $\left(2{xe}^{-{x}^{2}}\right)/\left(\sqrt{\pi }\mathrm{erfc}x\right)$ in the result.
Near $x=0$ this factor behaves as $2x/\sqrt{\pi }$ and hence the accuracy is largely determined by the machine precision. Also for large negative $x$, where the factor is $\sim {xe}^{-{x}^{2}}/\sqrt{\pi }$, accuracy is mainly limited by machine precision. However, for large positive $x$, the factor becomes $\sim 2{x}^{2}$ and to an extent relative accuracy is necessarily lost. The absolute accuracy $E$ is given by $E\simeq \left(2{xe}^{-{x}^{2}}/\sqrt{\pi }\right)\delta$ so absolute accuracy is guaranteed for all $x$.

None.

## 9  Example

The following program reads values of the argument $x$ from a file, evaluates the function at each value of $x$ and prints the results.