File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828namespace dgb {
2929namespace coin {
3030
31+ // MSVC does not define M_PI (non-standard POSIX macro) without _USE_MATH_DEFINES;
32+ // use a portable constexpr to keep the Windows/MSVC release lane building.
33+ constexpr double kPi = 3.14159265358979323846 ;
34+
3135// Oracle erf -- Abramowitz & Stegun formula 7.1.26 (util/math.py:100).
3236// erf(-x) = -erf(x) handled via sign capture, exactly as the oracle.
3337inline double erf_as7126 (double x)
@@ -57,7 +61,7 @@ inline double ierf(double z)
5761{
5862 double guess = 0.0 ;
5963 for (int i = 0 ; i < 10 ; ++i) {
60- const double dy = 2.0 * std::exp (-guess * guess) / std::sqrt (M_PI );
64+ const double dy = 2.0 * std::exp (-guess * guess) / std::sqrt (kPi );
6165 const double y_over_dy = (erf_as7126 (guess) - z) / dy;
6266 const double prev = guess;
6367 guess = guess - y_over_dy;
You can’t perform that action at this time.
0 commit comments