mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-15 07:10:37 +08:00
Bug #1790: Make areApprox
check numext::isnan
instead of bitwise equality (NaNs don't have to be bitwise equal).
This commit is contained in:
parent
2e099e8d8f
commit
35219cea68
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user