aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Deanna Hood <deanna.m.hood@gmail.com>2015-04-20 14:59:57 -0400
committerGravatar Deanna Hood <deanna.m.hood@gmail.com>2015-04-20 14:59:57 -0400
commite5048b5501a4c2cd86fa3f92ad214938eb3f9b3f (patch)
tree3e1006fdf481f4b1606d158038a01ed1d13d0053
parent249c48ba001f83978f84bf1befdf4867550ff6ea (diff)
Use std::isfinite when available
-rw-r--r--Eigen/src/Core/MathFunctions.h9
1 files 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<typename T>
EIGEN_DEVICE_FUNC
bool (isfinite)(const T& x)
{
- return x<NumTraits<T>::highest() && x>NumTraits<T>::lowest();
+ #ifdef EIGEN_HAS_C99_MATH
+ using std::isfinite;
+ return isfinite(x);
+ #else
+ return x<NumTraits<T>::highest() && x>NumTraits<T>::lowest();
+ #endif
}
template<typename T>