5 static const double a[] =
7 -3.969683028665376e+01,
9 -2.759285104469687e+02,
10 1.383577518672690e+02,
11 -3.066479806614716e+01,
15 static const double b[] =
17 -5.447609879822406e+01,
18 1.615858368580409e+02,
19 -1.556989798598866e+02,
20 6.680131188771972e+01,
21 -1.328068155288572e+01
24 static const double c[] =
26 -7.784894002430293e-03,
27 -3.223964580411365e-01,
28 -2.400758277161838e+00,
29 -2.549732539343734e+00,
30 4.374664141464968e+00,
34 static const double d[] =
36 7.784695709041462e-03,
37 3.224671290700398e-01,
38 2.445134137142996e+00,
73 template <
class type> type
norminv(type p)
96 return (((((
c[0]*q+
c[1])*q+
c[2])*q+
c[3])*q+
c[4])*q+
c[5]) /
97 ((((
d[0]*q+
d[1])*q+
d[2])*q+
d[3])*q+1);
102 q = sqrt(-2*log(1-p));
103 return -(((((
c[0]*q+
c[1])*q+
c[2])*q+
c[3])*q+
c[4])*q+
c[5]) /
104 ((((
d[0]*q+
d[1])*q+
d[2])*q+
d[3])*q+1);
111 return (((((
a[0]*r+
a[1])*r+
a[2])*r+
a[3])*r+
a[4])*r+
a[5])*q /
112 (((((
b[0]*r+
b[1])*r+
b[2])*r+
b[3])*r+
b[4])*r+1);
123 template <
class type> type
phi(type x)
126 type a1 = 0.254829592;
127 type a2 = -0.284496736;
128 type a3 = 1.421413741;
129 type a4 = -1.453152027;
130 type a5 = 1.061405429;
137 x = fabs(x)/sqrt(2.0);
140 type t = 1.0/(1.0 + p*x);
141 type y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x);
143 return 0.5*(1.0 + sign*y);
159 if((neg=(x < 0.0))) x = -x;
163 x *= (((-0.140543331*tmp+0.914624893)*tmp-1.645349621)*tmp+0.886226899)/((((0.012229801*tmp-0.329097515)*tmp+1.442710462)*tmp-2.118377725)*tmp+1.0);
167 tmp = sqrt(-log(0.5*(1.0-x)));
168 x = (((1.641345311*tmp+3.429567803)*tmp-1.624906493)*tmp-1.970840454)/((1.637067800*tmp+3.543889200)*tmp+1.0);
187 res -= (erf(res)-x)*exp(res*res)*0.886226925452757941;
188 res -= (erf(res)-x)*exp(res*res)*0.886226925452757941;
float fast_erfinv(float x)