[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 1

## erf, erfl, erfc, or erfcl Subroutine

### Purpose

Computes the error and complementary error functions.

### Libraries

IEEE Math Library (libm.a)
or System V Math Library (libmsaa.a)

### Syntax

`#include <math.h>`
```double erf (x)
double x;```
```long double erfl (x)
long double x;```
```double erfc (x)
double x;```
```long double erfcl (x)
long double x;```

### Description

The erf and erfl subroutines return the error function of the x parameter, defined for the erf subroutine as the following:

`erf(x) = (2/sqrt(pi) * (integral [0 to x] of exp(-(t**2)) dt)`
`erfc(x) = 1.0 - erf(x)`

The erfc and erfcl subroutines are provided because of the extreme loss of relative accuracy if erf ( x) is called for large values of the x parameter and the result is subtracted from 1. For example, 12 decimal places are lost when calculating (1.0 - erf(5) ).

Note: Compile any routine that uses subroutines from the libm.a library with the -lm flag. To compile the erf.c file, for example, enter:
`cc erf.c -lm`

### Parameters

 x Specifies a double-precision floating-point value.

### Implementation Specifics

These subroutines are part of Base Operating System (BOS) Runtime.

### Related Information

The exp, expm1, log, log10, log1p, or pow subroutine, sqrt or cbrt subroutine.

Subroutines Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.

128-Bit long double Floating-Point Format in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.

[ Previous | Next | Contents | Glossary | Home | Search ]