diff options
author | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2020-01-11 14:57:22 +0100 |
---|---|---|
committer | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2020-01-11 14:57:22 +0100 |
commit | 35219cea68f8ac9f5624072492cab1e370155b1f (patch) | |
tree | 7e8bfa3f68df67e21346bda0b1872b1949d73420 | |
parent | 2e099e8d8f43523b5ac300ae508a7a085ec8c0f3 (diff) |
Bug #1790: Make `areApprox` check `numext::isnan` instead of bitwise equality (NaNs don't have to be bitwise equal).
-rw-r--r-- | test/packetmath_test_shared.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/packetmath_test_shared.h b/test/packetmath_test_shared.h index 046fd8104..de1a05508 100644 --- a/test/packetmath_test_shared.h +++ b/test/packetmath_test_shared.h @@ -100,8 +100,12 @@ template<typename Scalar> bool areApprox(const Scalar* a, const Scalar* b, int s { for (int i=0; i<size; ++i) { - if ((!internal::biteq(a[i],b[i])) && a[i]!=b[i] && !internal::isApprox(a[i],b[i])) + if (a[i]!=b[i] && !internal::isApprox(a[i],b[i])) { + if((numext::isnan)(a[i]) && (numext::isnan)(b[i])) + { + continue; + } std::cout << "ref: [" << Map<const Matrix<Scalar,1,Dynamic> >(a,size) << "]" << " != vec: [" << Map<const Matrix<Scalar,1,Dynamic> >(b,size) << "]\n"; return false; } |