921e0177efc9028f65c65173d32b2f959850d047
[unix-history] / usr / src / lib / libm / common_source / erf.3
From Prof. Kahan at UC at Berkeley
.\" Copyright (c) 1985, 1991 Regents of the University of California.
.\" All rights reserved.
.\"
.\" %sccs.include.redist.man%
.\"
.\" @(#)erf.3 6.3 (Berkeley) %G%
.\"
.Dd
.Dt ERF 3
.Os BSD 4.3
.Sh NAME
.Nm erf ,
.Nm erfc
.Nd error function operators
.Sh SYNOPSIS
.Fd #include <math.h>
.Ft double
.Fn erf "double x"
.Ft double
.Fn erfc "double x"
.Sh DESCRIPTION
These functions calculate the error function of
.Fa x .
.Pp
The
.Fn erf
calculates the error function of x; where
.Bd -filled -offset indent
.if n \{\
erf(x) = 2/sqrt(pi)\(**\|integral from 0 to x of exp(\-t\(**t) dt. \}
.if t \{\
erf\|(x) :=
(2/\(sr\(*p)\|\(is\d\s8\z0\s10\u\u\s8x\s10\d\|exp(\-t\u\s82\s10\d)\|dt. \}
.Ed
.Pp
The
.Fn erfc
function calculates the complementary error function of
.Fa x ;
that is
.Fn erfc
subtracts the result of
the error function
.Fn erf x
from 1.0.
This is useful, since for large
.Fa x ,
such as x = 10, 12 places disappear.
.Sh SEE ALSO
.Xr math 3
.Sh HISTORY
The
.Fn erf
and
.Fn erfc
functions
appeared in
.Bx 4.3 .