From 37a77ca334e98770721881c28e093dee2600f5f7 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Thu, 27 Aug 2026 16:32:04 +0200 Subject: [PATCH] rugnux: use the project's PI in the anomalous map phase, not M_PI M_PI is not standard C++ and MSVC does not define it without _USE_MATH_DEFINES, so the Windows rugnux build failed on the anomalous-map phase shift added in b0234a1b4: ModelValidation.cpp(350): error C2065: 'M_PI': undeclared identifier common/JFJochMath.h carries a plain constexpr PI for exactly this reason - its header comment names MSVC - and BraggIntegrationEngine.cpp already uses it that way. Same idiom here, same include comment. The digits are those of glibc's M_PI, so the phase, the map and the site heights are bit-identical; this is a portability fix and nothing else. Verified that no other M_PI is left anywhere in the viewer-reachable subset, and that nothing in the files this branch adds or changes there reaches for a GCC builtin, a POSIX header or __attribute__. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_016L1qig74oYQzfUJJZbbxFh --- rugnux/ModelValidation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rugnux/ModelValidation.cpp b/rugnux/ModelValidation.cpp index 107adc2e3..6c2e02526 100644 --- a/rugnux/ModelValidation.cpp +++ b/rugnux/ModelValidation.cpp @@ -21,6 +21,7 @@ #include // Ccp4 map I/O #include // Mtz (map-coefficient output) +#include "../common/JFJochMath.h" // PI (M_PI is not standard, and MSVC does not define it) #include "../common/Logger.h" #include "../image_analysis/scale_merge/ReindexAmbiguity.h" // ReindexReflections @@ -348,7 +349,7 @@ ModelValidationResult ValidateAgainstModel(const std::vector & const auto it = danom_by_hkl.find(hkl_key(hv.hkl)); if (it == danom_by_hkl.end()) continue; - const auto phi = static_cast(std::arg(hv.value) - M_PI / 2); + const auto phi = static_cast(std::arg(hv.value) - PI / 2); mapanom.v.push_back({hv.hkl, it->second * std::polar(1.0f, phi)}); } result.anomalous_pairs = static_cast(mapanom.v.size());