Make Approx::margin inclusive

Fixes #952, related to #980
This commit is contained in:
Martin Hořeňovský
2017-10-30 15:25:48 +01:00
parent 06586b7180
commit a6cf19abff
6 changed files with 131 additions and 9 deletions

View File

@@ -57,7 +57,8 @@ namespace Detail {
if (relativeOK) {
return true;
}
return std::fabs(lhs_v - rhs.m_value) < rhs.m_margin;
return std::fabs(lhs_v - rhs.m_value) <= rhs.m_margin;
}
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
@@ -130,7 +131,7 @@ namespace Detail {
if (relativeOK) {
return true;
}
return std::fabs(lhs - rhs.m_value) < rhs.m_margin;
return std::fabs(lhs - rhs.m_value) <= rhs.m_margin;
}
friend bool operator == ( Approx const& lhs, double rhs ) {