From c6efc4e0ba4b9acb8f99e6e976d4853bedc21db5 Mon Sep 17 00:00:00 2001 From: Antonio Sanchez Date: Fri, 11 Dec 2020 14:34:31 -0800 Subject: Replace M_LOG2E and M_LN2 with custom macros. For these to exist we would need to define `_USE_MATH_DEFINES` before `cmath` or `math.h` is first included. However, we don't control the include order for projects outside Eigen, so even defining the macro in `Eigen/Core` does not fix the issue for projects that end up including `` before Eigen does (explicitly or transitively). To fix this, we define `EIGEN_LOG2E` and `EIGEN_LN2` ourselves. --- test/packetmath.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/packetmath.cpp') diff --git a/test/packetmath.cpp b/test/packetmath.cpp index 0e49d93a9..f19d72502 100644 --- a/test/packetmath.cpp +++ b/test/packetmath.cpp @@ -495,7 +495,7 @@ void packetmath() { // c++11 has std::log2 for real, but not for complex types. template Scalar log2(Scalar x) { - return Scalar(M_LOG2E) * std::log(x); + return Scalar(EIGEN_LOG2E) * std::log(x); } template -- cgit v1.2.3