Name

erf, erff, erfl, erfc, erfcf, erfcl
- error function and complementary error function

Library

libm.lib

Synopsis

  #include <math.h>
  double erf (double x);
  float erff (float x);
  long double erf (long double x);
  double erfc (double x);
  float erfcf (float x);
  long double erfcl (long double x);

Detailed description

These functions calculate the error function of x.

The erf, erff, and erfl functions calculate the error function of x; where,

         

         
erf(x) = 2/sqrt(pi)*integral from 0 to x of exp(-t*t) dt.
erf(x) :=
(2/v/pi)I00x0exp(-t20)dt.

         

The erfc, erfcf, and erfcl functions calculate the complementary error function of x; that is erfc subtracts the result of the error function erf (x);
from 1.0. This is useful, since for large x places disappear.

The functions erfl and erfcl
are aliases to the functions erf and erfc respectively.


Examples

#include <math.h>
int main( void )
{
   double x, y;
   x = 0.75;
   y = erf( x );
   printf( "erf( %f ) = %f\n", x, y );
   y = erff( x );
   printf( "erff( %f ) = %f\n",x, y );
   y = erfl( x );
   printf( "erfl( %f ) = %f\n",x, y );
   y = erfc( x );
   printf( "erf( %f ) = %f\n", x, y );
   y = erfcf( x );
   printf( "erff( %f ) = %f\n",x, y );
   y = erfcl( x );
   printf( "erfl( %f ) = %f\n",x, y );
}

         

Output

erf ( 0.75 )  = 0.711156
erff( 0.75 )  = 0.711156
erfl( 0.75 )  = 0.711156
erfc( 0.75 )  = 0.288844
erfcf( 0.75 ) = 0.288844
erfcl( 0.75 ) = 0.288844

         


See also

math

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top