1 #ifndef OPENMM_MSVC_ERFC_H_
2 #define OPENMM_MSVC_ERFC_H_
12 #define M_PI 3.14159265358979323846264338327950288
14 #if _MSC_VER <= 1700 // 1700 is VC11, 1800 is VC12
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;
84 #endif // _MSC_VER <= 1700
87 #endif // OPENMM_MSVC_ERFC_H_