HPlogo HP-UX Reference Volume 4 of 5 > e

erf(3M)

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

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 accuracy 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.

STANDARDS CONFORMANCE

erf(): SVID3, XPG4.2

erfc(): SVID3, XPG4.2

© Hewlett-Packard Development Company, L.P.