aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/fastmath.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-10-28 16:27:20 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-10-28 16:27:20 +0100
commit28ddb5158dbe2a633a11f77ad7145ceae08abbf3 (patch)
tree277014431723c270d827294386a99b359fe7a4af /test/fastmath.cpp
parent1a842c0dc441cca1bd66a516b16d7fe6a4c0ba26 (diff)
Enable std::isfinite/nan/inf on MSVC 2013 and newer and clang. Fix isinf for gcc4.4 and older msvc with fast-math.
Diffstat (limited to 'test/fastmath.cpp')
-rw-r--r--test/fastmath.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/fastmath.cpp b/test/fastmath.cpp
index 2911c0544..16462d54f 100644
--- a/test/fastmath.cpp
+++ b/test/fastmath.cpp
@@ -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);