HP-UX Reference (11i v1 05/09) - 3 Library Functions A-M (vol 6)
e
erf(3M) erf(3M)
NAME
erf( ), erfc( ) - error function and complementary error function
SYNOPSIS
#include <math.h>
double erf(double x);
double erfc(double x);
DESCRIPTION
erf() returns the error function of x, defined as:
(2/
sqrt(pi)) *
(integral with respect to t from 0 to x of (
exp(pow(-t,2))))
erfc() returns the complementary value, 1.0 −
erf(x). It prevents the extreme loss of relative accu-
racy if
erf(x) is called for a large x and the result is subtracted from 1.0 (for example, for x =5,twelve
decimal places are lost).
The ISO/ANSI C committee has approved the
erf() and
erfc() functions for inclusion in the C9X draft
standard.
To use these functions, compile either with the default
-Ae option or with the -Aa
and
-D_HPUX_SOURCE options. Make sure your program includes <
math.h>. Link in the math library by
specifying
-lm on the compiler or linker command line.
RETURN VALUE
If x is +INFINITY, erf() returns 1.0.
If x is −INFINITY,
erf() returns −1.0.
If x is +INFINITY,
erfc() returns zero.
If x is −INFINITY, erfc() returns 2.0.
If x is NaN,
erf() and erfc() return NaN.
If the correct value after rounding would be smaller in magnitude than MINDOUBLE, erf() and erfc()
return zero.
ERRORS
No errors are defined.
SEE ALSO
exp(3M), pow(3M), sqrt(3M), math(5), values(5).
STANDARDS CONFORMANCE
erf(): SVID3, XPG4.2
erfc(): SVID3, XPG4.2
Section 3−−232 Hewlett-Packard Company − 1 − HP-UX 11i Version 1: September 2005