Skip to content

Commit b6f5c03

Browse files
The9CatCopilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent f5a39b4 commit b6f5c03

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

utils/Test/testEmpDeproj.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)