Enable std::isfinite/nan/inf on MSVC 2013 and newer and clang. Fix isinf for gcc4.4 and older msvc with fast-math.

This commit is contained in:
Gael Guennebaud
2015-10-28 16:27:20 +01:00
parent 1a842c0dc4
commit 28ddb5158d
2 changed files with 30 additions and 28 deletions

View File

@@ -18,6 +18,14 @@ void check(bool b, bool ref)
std::cout << " BAD ";
}
#if EIGEN_COMP_MSVC < 1800
namespace std {
template<typename T> bool (isfinite)(T x) { return _finite(x); }
template<typename T> bool (isnan)(T x) { return _isnan(x); }
template<typename T> bool (isinf)(T x) { return _fpclass(x)==_FPCLASS_NINF || _fpclass(x)==_FPCLASS_PINF; }
}
#endif
template<typename T>
void check_inf_nan(bool dryrun) {
Matrix<T,Dynamic,1> m(10);