標(biāo)準(zhǔn)正態(tài)分布函數(shù)的近似計(jì)算
#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);
}
}
*博客內(nèi)容為網(wǎng)友個(gè)人發(fā)布,僅代表博主個(gè)人觀點(diǎn),如有侵權(quán)請(qǐng)聯(lián)系工作人員刪除。