[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1

erf, erff, or erfl 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;

float erff (x)
float x;
long double erfl (x)
long double x;

Description

The erf, erff, 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)
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

An application wishing to check for error situations should set errno to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these functions. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.

Parameters

x Specifies a double-precision floating-point value.

Return Values

Upon successful completion, the erf, erff, and erfl subroutines return the value of the error function.

If x is NaN, a NaN is returned.

If x is ±0, ±0 is returned.

If x is ±Inf, ±1 is returned.

If x is subnormal, a range error may occur, and 2 * x/sqrt(pi) should be returned.

Related Information

erfc, erfcf, or erfcl Subroutine, exp, expf, or expl Subroutine, feclearexcept Subroutine, fetestexcept Subroutine, and class, _class, finite, isnan, or unordered Subroutines.

The sqrt, sqrtf, or sqrtl Subroutine in AIX 5L Version 5.2 Technical Reference: Base Operating System and Extensions Volume 2.

Subroutines Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

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

math.h in AIX 5L Version 5.2 Files Reference.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]