Consider inf/nan in scalar test_isApprox.

(cherry picked from commit 0c859cf35d67fe2abf8bc79810e88732429fc88c)
This commit is contained in:
Antonio Sánchez 2022-04-01 17:00:24 +00:00 committed by Antonio Sanchez
parent 8e7bd5397f
commit 86d958e8f2

View File

@ -422,7 +422,13 @@ template<> inline long double test_precision<std::complex<long double> >() { ret
#define EIGEN_TEST_SCALAR_TEST_OVERLOAD(TYPE) \ #define EIGEN_TEST_SCALAR_TEST_OVERLOAD(TYPE) \
inline bool test_isApprox(TYPE a, TYPE b) \ inline bool test_isApprox(TYPE a, TYPE b) \
{ return internal::isApprox(a, b, test_precision<TYPE>()); } \ { return numext::equal_strict(a, b) || \
((numext::isnan)(a) && (numext::isnan)(b)) || \
(internal::isApprox(a, b, test_precision<TYPE>())); } \
inline bool test_isCwiseApprox(TYPE a, TYPE b, bool exact) \
{ return numext::equal_strict(a, b) || \
((numext::isnan)(a) && (numext::isnan)(b)) || \
(!exact && internal::isApprox(a, b, test_precision<TYPE>())); } \
inline bool test_isMuchSmallerThan(TYPE a, TYPE b) \ inline bool test_isMuchSmallerThan(TYPE a, TYPE b) \
{ return internal::isMuchSmallerThan(a, b, test_precision<TYPE>()); } \ { return internal::isMuchSmallerThan(a, b, test_precision<TYPE>()); } \
inline bool test_isApproxOrLessThan(TYPE a, TYPE b) \ inline bool test_isApproxOrLessThan(TYPE a, TYPE b) \