Format
#include <math.h>
double erf(double x);
double erfc(double x);
Language Level: ILE C Extension
Threadsafe: Yes.
Description
The erf() function calculates the error function of:
The erfc() function computes the value of 1.0 - erf(x). The erfc() function is used in place of erf() for large values of x.
Return Value
The erf() function returns a double value that represents the error function. The erfc() function returns a double value representing 1.0 - erf.
Example that uses erf()
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);
}
/***************** Output should be similar to: *****************
Error value for 0.1: 0.112463
Error value for 10.0: 2.088488e-45
*/
Related Information