diff options
-rw-r--r-- | Eigen/src/Core/MathFunctions.h | 3 | ||||
-rw-r--r-- | test/array.cpp | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index 787634081..734a5e373 100644 --- a/Eigen/src/Core/MathFunctions.h +++ b/Eigen/src/Core/MathFunctions.h @@ -421,7 +421,8 @@ struct round_retval EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar& x) { - return (x < 0.0) ? M_PI : 0.0; } + const double pi = std::acos(-1.0); + return (x < 0.0) ? pi : 0.0; } }; template<typename Scalar> diff --git a/test/array.cpp b/test/array.cpp index efccd2b0c..0208ba7c9 100644 --- a/test/array.cpp +++ b/test/array.cpp @@ -237,7 +237,7 @@ template<typename ArrayType> void array_real(const ArrayType& m) VERIFY_IS_APPROX(sinh(m1), 0.5*(exp(m1)-exp(-m1))); VERIFY_IS_APPROX(cosh(m1), 0.5*(exp(m1)+exp(-m1))); VERIFY_IS_APPROX(tanh(m1), (0.5*(exp(m1)-exp(-m1)))/(0.5*(exp(m1)+exp(-m1)))); - VERIFY_IS_APPROX(arg(m1), ((ArrayType)(m1<0))*M_PI); + VERIFY_IS_APPROX(arg(m1), ((ArrayType)(m1<0))*std::acos(-1.0)); VERIFY((round(m1) <= ceil(m1) && round(m1) >= floor(m1)).all()); VERIFY(isNaN(m1*0.0/0.0).all()); VERIFY(isInf(m1/0.0).all()); |