博客专栏

EEPW首页>博客> 标准正态分布函数的近似计算

标准正态分布函数的近似计算

发布人:luker 时间:2020-09-30 来源:工程师 发布文章

#define pi(3.1415926535898)
#define a0 (0.33267)
#define a1 (0.4361836)
#define a2(-0.1201676)
#define a3(0.9372986)
double test(double x)
{
double t = (1.0/(1.0+a0*fabs((x))));
return exp(-x*x/2.0) * t * (a1 + a2*t + a3*t*t) / sqrt(2.0*pi);
}
double testfun(double x)
{
if(x == 0)
{
return 0.5;
}
else if(x > 0)
{
return 1.0 - test(x)/sqrt(2*pi);
}
else
{
return test(x)/sqrt(2*pi);
}
}

*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。



关键词:

相关推荐

技术专区

关闭