summaryrefslogtreecommitdiff
path: root/test/correctness
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2016-03-06 16:32:38 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2016-03-06 16:32:38 +0100
commit7468e2ba9db068ef7a11b11d12ac66752ea96713 (patch)
treecfca67196d719d651e8e54621ff5c77ba36cf346 /test/correctness
parentc93cd2fc2d92d98a231ec35eb09c40ea464afd80 (diff)
Adjusted the correctness-test error margins
Diffstat (limited to 'test/correctness')
-rw-r--r--test/correctness/tester.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/correctness/tester.cc b/test/correctness/tester.cc
index d9836500..8169f700 100644
--- a/test/correctness/tester.cc
+++ b/test/correctness/tester.cc
@@ -280,21 +280,21 @@ bool TestSimilarity(const T val1, const T val2) {
const auto difference = std::fabs(val1 - val2);
// Set the allowed error margin for floating-point comparisons
- constexpr auto kErrorMarginRelative = 1.0e-2;
- constexpr auto kErrorMarginAbsolute = 1.0e-10;
+ constexpr auto kErrorMarginRelative = T{0.025};
+ constexpr auto kErrorMarginAbsolute = T{1.0e-6};
// Shortcut, handles infinities
if (val1 == val2) {
return true;
}
// The values are zero or very small: the relative error is less meaningful
- else if (val1 == 0 || val2 == 0 || difference < static_cast<T>(kErrorMarginAbsolute)) {
- return (difference < static_cast<T>(kErrorMarginAbsolute));
+ else if (val1 == 0 || val2 == 0 || difference < kErrorMarginAbsolute) {
+ return (difference < kErrorMarginAbsolute);
}
// Use relative error
else {
const auto absolute_sum = std::fabs(val1) + std::fabs(val2);
- return (difference / absolute_sum) < static_cast<T>(kErrorMarginRelative);
+ return (difference / absolute_sum) < kErrorMarginRelative;
}
}