# 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 <nag.h>
#include <nags.h>

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:     x – doubleInput
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.

### 9.1  Program Text

Program Text (s15adce.c)

### 9.2  Program Data

Program Data (s15adce.d)

### 9.3  Program Results

Program Results (s15adce.r)
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 19, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.6159538626670837, "perplexity_flag": "middle"}