erf - erfc -- Calculate Error Functions

Format

#include <math.h>
double erf(double x);
double erfc(double x);

Language Level: XPG4
erf calculates the error function of

erfc computes the value of 1.0 - erf(x). erfc is used in place of erf for large values of x.

Return Value
erf returns a double value that represents the error function. erfc returns a double value representing 1.0 - erf.

Example
This example uses erf and erfc to compute the error function of two numbers.

#include <stdio.h>
#include <math.h>
double smallx, largex, value;
int main(void)
{
   smallx = 0.1;
   largex = 10.0;
   value = erf(smallx);         /* value = 0.112463 */
   printf("Error value for 0.1: %lf\n", value);
   value = erfc(largex);        /* value = 2.088488e-45 */
   printf("Error value for 10.0: %le\n", value);
   return 0;
   /*******************************************************
      The output should be:
      Error value for 0.1: 0.112463
      Error value for 10.0:2.088488e-45                                                                         
   *******************************************************/
}


Bessel Functions -- Solve Differential Equations
gamma -- Gamma Function
<math.h>