Don't use M_PI since it's only guaranteed to be defined in Eigen/Geometry

This commit is contained in:
Deanna Hood 2015-04-08 13:59:18 -05:00
parent 83e5b7656b
commit 085aa8e601
2 changed files with 3 additions and 2 deletions

View File

@ -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>

View File

@ -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());