当前位置: C语言 -- 标准库 -- <math.h> -- erf

erf函数


概要:
#include <math.h>
double erf(double x);

描述:

该函数计算参数x的误差函数。


参数:
double x

参数为一个double类型的浮点数。


返回值:

函数返回erf x=2π 0xe-t2dt


范例:
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
/*函数erf范例*/

#include <math.h>
#include <stdio.h>

int main(void)
{
    double x = 2.0;
    double y;

    y = erf(x);
    printf("The error function of %.6f is %.6f.\n", x, y);

    return 0;
}

输出:

The error function of 2.000000 is 0.995322.


相关内容:
erff float类型的误差函数。
erfl long double类型的误差函数。