From 58abf0eb98db7dc5f31e499c86d4e464a826ee99 Mon Sep 17 00:00:00 2001 From: Jitse Niesen Date: Fri, 25 Feb 2011 08:56:37 +0000 Subject: Use absolute error to test sum in which cancellation may occur. --- test/redux.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/redux.cpp') diff --git a/test/redux.cpp b/test/redux.cpp index b9004fbd2..57b4603c5 100644 --- a/test/redux.cpp +++ b/test/redux.cpp @@ -89,7 +89,7 @@ template void vectorRedux(const VectorType& w) minc = std::min(minc, internal::real(v[j])); maxc = std::max(maxc, internal::real(v[j])); } - VERIFY_IS_APPROX(s, v.head(i).sum()); + VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(s - v.head(i).sum()), Scalar(1)); VERIFY_IS_APPROX(p, v.head(i).prod()); VERIFY_IS_APPROX(minc, v.real().head(i).minCoeff()); VERIFY_IS_APPROX(maxc, v.real().head(i).maxCoeff()); @@ -123,7 +123,7 @@ template void vectorRedux(const VectorType& w) minc = std::min(minc, internal::real(v[j])); maxc = std::max(maxc, internal::real(v[j])); } - VERIFY_IS_APPROX(s, v.segment(i, size-2*i).sum()); + VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(s - v.segment(i, size-2*i).sum()), Scalar(1)); VERIFY_IS_APPROX(p, v.segment(i, size-2*i).prod()); VERIFY_IS_APPROX(minc, v.real().segment(i, size-2*i).minCoeff()); VERIFY_IS_APPROX(maxc, v.real().segment(i, size-2*i).maxCoeff()); -- cgit v1.2.3