1 #ifndef OPENMM_MSVC_ERFC_H_
2 #define OPENMM_MSVC_ERFC_H_
13 #define M_PI 3.14159265358979323846264338327950288
16 #if _MSC_VER <= 1700 // 1700 is VC11, 1800 is VC12
25 static const double rel_error= 1E-12;
29 static double erfc(
double x);
31 static double erf(
double x)
36 static const double two_sqrtpi= 1.128379167095512574;
40 double sum= x, term= x, xsqr= x*x;
49 }
while (fabs(term)/sum > rel_error);
50 return two_sqrtpi*sum;
54 static double erfc(
double x)
60 static const double one_sqrtpi= 0.564189583547756287;
66 return 2.0 - erfc(-x);
69 double c=x, d=x*x+0.5;
82 }
while (fabs(q1-q2)/q2 > rel_error);
83 return one_sqrtpi*exp(-x*x)*q2;
86 #endif // _MSC_VER <= 1700
89 #endif // OPENMM_MSVC_ERFC_H_