diff options
| author | Martin Hořeňovský | 2019-10-04 13:23:14 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2019-10-04 13:28:43 +0200 |
| commit | 02ee130bd0191b084821ccfa2dfd7eba9df197aa (patch) | |
| tree | ec15e2e71ccc12cf54dd48b1070e3b92fce24bb6 /include | |
| parent | 815f99541dc352c4adbb2f8474f7f67108a830d2 (diff) | |
| download | catch3-02ee130bd0191b084821ccfa2dfd7eba9df197aa.tar.gz | |
Special case Approx(inf) to better follow user expectations
Diffstat (limited to 'include')
| -rw-r--r-- | include/internal/catch_approx.cpp | 3 |
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) { |