From e5048b5501a4c2cd86fa3f92ad214938eb3f9b3f Mon Sep 17 00:00:00 2001 From: Deanna Hood Date: Mon, 20 Apr 2015 14:59:57 -0400 Subject: [PATCH] Use std::isfinite when available --- Eigen/src/Core/MathFunctions.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index a1ea059b7..1ce935909 100644 --- a/Eigen/src/Core/MathFunctions.h +++ b/Eigen/src/Core/MathFunctions.h @@ -787,13 +787,16 @@ inline EIGEN_MATHFUNC_RETVAL(pow, Scalar) pow(const Scalar& x, const Scalar& y) return EIGEN_MATHFUNC_IMPL(pow, Scalar)::run(x, y); } -// std::isfinite is non standard, so let's define our own version, -// even though it is not very efficient. template EIGEN_DEVICE_FUNC bool (isfinite)(const T& x) { - return x::highest() && x>NumTraits::lowest(); + #ifdef EIGEN_HAS_C99_MATH + using std::isfinite; + return isfinite(x); + #else + return x::highest() && x>NumTraits::lowest(); + #endif } template