Bug #1790: Make areApprox check numext::isnan instead of bitwise equality (NaNs don't have to be bitwise equal).

This commit is contained in:
Christoph Hertzberg 2020-01-11 14:57:22 +01:00
parent 2e099e8d8f
commit 35219cea68

View File

@ -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;
}