13 double erfc(
double x);
15 static const double rel_error= 1E-12;
19 inline double erf(
double x)
24 static const double two_sqrtpi= 1.128379167095512574;
28 double sum= x, term= x, xsqr= x*x;
38 }
while (fabs(term/sum) > rel_error);
39 return two_sqrtpi*sum;
42 inline double erfc(
double x)
49 static const double one_sqrtpi= 0.564189583547756287;
54 return 2.0 - erfc(-x);
57 double c=x, d=x*x+0.5;
71 }
while (fabs(q1-q2)/q2 > rel_error);
72 return one_sqrtpi*exp(-x*x)*q2;