Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-10-04 13:23:14 +0200
committerMartin Hořeňovský2019-10-04 13:28:43 +0200
commit02ee130bd0191b084821ccfa2dfd7eba9df197aa (patch)
treeec15e2e71ccc12cf54dd48b1070e3b92fce24bb6 /include
parent815f99541dc352c4adbb2f8474f7f67108a830d2 (diff)
downloadcatch3-02ee130bd0191b084821ccfa2dfd7eba9df197aa.tar.gz
Special case Approx(inf) to better follow user expectations
Diffstat (limited to 'include')
-rw-r--r--include/internal/catch_approx.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/internal/catch_approx.cpp b/include/internal/catch_approx.cpp
index da7e4020..32b5e043 100644
--- a/include/internal/catch_approx.cpp
+++ b/include/internal/catch_approx.cpp
@@ -52,7 +52,8 @@ namespace Detail {
bool Approx::equalityComparisonImpl(const double other) const {
// First try with fixed margin, then compute margin based on epsilon, scale and Approx's value
// Thanks to Richard Harris for his help refining the scaled margin value
- return marginComparison(m_value, other, m_margin) || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(m_value)));
+ return marginComparison(m_value, other, m_margin)
+ || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(std::isinf(m_value)? 0 : m_value)));
}
void Approx::setMargin(double newMargin) {