blob: ea18f7be7ea18cf558e27c3efa8e45dc12f640e6 [file]
<html lang="en">
<head>
<title>erf - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Math.html#Math" title="Math">
<link rel="prev" href="cosh.html#cosh" title="cosh">
<link rel="next" href="exp.html#exp" title="exp">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="erf"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="exp.html#exp">exp</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="cosh.html#cosh">cosh</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Math.html#Math">Math</a>
<hr>
</div>
<h3 class="section">1.14 <code>erf</code>, <code>erff</code>, <code>erfc</code>, <code>erfcf</code>&mdash;error function</h3>
<p><a name="index-erf-35"></a><a name="index-erff-36"></a><a name="index-erfc-37"></a><a name="index-erfcf-38"></a><strong>Synopsis</strong>
<pre class="example"> #include &lt;math.h&gt;
double erf(double <var>x</var>);
float erff(float <var>x</var>);
double erfc(double <var>x</var>);
float erfcf(float <var>x</var>);
</pre>
<p><strong>Description</strong><br>
<code>erf</code> calculates an approximation to the &ldquo;error function&rdquo;,
which estimates the probability that an observation will fall within
<var>x</var> standard deviations of the mean (assuming a normal
distribution).
<p><code>erfc</code> calculates the complementary probability; that is,
<code>erfc(</code><var>x</var><code>)</code> is <code>1 - erf(</code><var>x</var><code>)</code>. <code>erfc</code> is computed directly,
so that you can use it to avoid the loss of precision that would
result from subtracting large probabilities (on large <var>x</var>) from 1.
<p><code>erff</code> and <code>erfcf</code> differ from <code>erf</code> and <code>erfc</code> only in the
argument and result types.
<p><br>
<strong>Returns</strong><br>
For positive arguments, <code>erf</code> and all its variants return a
probability&mdash;a number between 0 and 1.
<p><br>
<strong>Portability</strong><br>
None of the variants of <code>erf</code> are ANSI C.
<p><br>
</body></html>