aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/redux.cpp
diff options
context:
space:
mode:
authorGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2011-02-25 08:56:37 +0000
committerGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2011-02-25 08:56:37 +0000
commit58abf0eb98db7dc5f31e499c86d4e464a826ee99 (patch)
treec791d6167a0bc48bf83a982bc66f5f9340ec542e /test/redux.cpp
parentef732659876f0000e38eb46767d3522111cbeae8 (diff)
Use absolute error to test sum in which cancellation may occur.
Diffstat (limited to 'test/redux.cpp')
-rw-r--r--test/redux.cpp4
1 files changed, 2 insertions, 2 deletions
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<typename VectorType> 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<typename VectorType> 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());