@@ -24,6 +24,9 @@ int main(int argc, char* argv[])
2424 double H, Rmin, Rmax, Rcut, Rwid;
2525 int Nr, Ngrid, NumR, Nint;
2626
27+ // Define pi in a portable way instead of relying on non-standard M_PI
28+ constexpr double pi = std::acos (-1.0 );
29+
2730 // Parse command-line options
2831 //
2932 cxxopts::Options options (" testEmpDeproj" ,
@@ -105,8 +108,8 @@ int main(int argc, char* argv[])
105108 dSigmaFunc = [](double R)->double
106109 { return -3.0 * R / std::pow (1.0 + R*R, 2.5 ); };
107110 // Expected result
108- RhoFunc = [](double r)->double
109- { return 2.0 / std::pow (1.0 + r*r, 2.0 ) / M_PI ; };
111+ RhoFunc = [pi ](double r)->double
112+ { return 2.0 / std::pow (1.0 + r*r, 2.0 ) / pi ; };
110113 break ;
111114 case Type::Gaussian:
112115 // Test function
@@ -116,8 +119,8 @@ int main(int argc, char* argv[])
116119 dSigmaFunc = [](double R)->double
117120 { return -R*exp (-0.5 *R*R); };
118121 // Expected result
119- RhoFunc = [](double r)->double
120- { return exp (-0.5 *r*r)/sqrt (2.0 *M_PI ); };
122+ RhoFunc = [pi ](double r)->double
123+ { return exp (-0.5 *r*r)/sqrt (2.0 *pi ); };
121124 break ;
122125 default :
123126 case Type::Plummer:
0 commit comments