1 #ifndef OPENMM_MSVC_ERFC_H_
2 #define OPENMM_MSVC_ERFC_H_
23 static const double rel_error= 1E-12;
27 static double erfc(
double x);
29 static double erf(
double x)
34 static const double two_sqrtpi= 1.128379167095512574;
38 double sum= x, term= x, xsqr= x*x;
47 }
while (fabs(term)/sum > rel_error);
48 return two_sqrtpi*sum;
52 static double erfc(
double x)
58 static const double one_sqrtpi= 0.564189583547756287;
64 return 2.0 - erfc(-x);
67 double c=x, d=x*x+0.5;
80 }
while (fabs(q1-q2)/q2 > rel_error);
81 return one_sqrtpi*exp(-x*x)*q2;
86 #endif // OPENMM_MSVC_ERFC_H_