helper: consider NAN equal to NAN such that vectors can be compared exactly

This commit is contained in:
Matthias Grob
2019-09-18 09:59:50 +02:00
committed by Julian Kent
parent 33a629105c
commit bbaa93880b
2 changed files with 7 additions and 4 deletions
+3 -1
View File
@@ -34,7 +34,9 @@ bool is_finite(Type x) {
template<typename Type>
bool isEqualF(const Type x, const Type y, const Type eps = 1e-4f)
{
return matrix::fabs(x - y) <= eps;
return (matrix::fabs(x - y) <= eps)
|| (isnan(x) && isnan(y))
|| (isinf(x) && isinf(y));
}
/**