diff options
| author | Martin Hořeňovský | 2019-10-17 11:21:17 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2019-10-17 16:40:37 +0200 |
| commit | 31906d83ec1fff2b667a32a0730c649d12889ef6 (patch) | |
| tree | 417ce14bd88616290bb975e68c9d036c352c038a /include/internal/catch_matchers_floating.cpp | |
| parent | 91fa55303b4aae109939ead5ca2ccc94b1f2e044 (diff) | |
| download | catch3-31906d83ec1fff2b667a32a0730c649d12889ef6.tar.gz | |
Add parenthesis to prevent macro expansions of min/max
Closes #1772
Diffstat (limited to 'include/internal/catch_matchers_floating.cpp')
| -rw-r--r-- | include/internal/catch_matchers_floating.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/internal/catch_matchers_floating.cpp b/include/internal/catch_matchers_floating.cpp index be969397..cdc0f0cb 100644 --- a/include/internal/catch_matchers_floating.cpp +++ b/include/internal/catch_matchers_floating.cpp @@ -142,7 +142,7 @@ namespace Floating { WithinUlpsMatcher::WithinUlpsMatcher(double target, uint64_t ulps, FloatingPointKind baseType) :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } { CATCH_ENFORCE(m_type == FloatingPointKind::Double - || m_ulps < std::numeric_limits<uint32_t>::max(), + || m_ulps < (std::numeric_limits<uint32_t>::max)(), "Provided ULP is impossibly large for a float comparison."); } @@ -201,7 +201,7 @@ namespace Floating { } bool WithinRelMatcher::match(double const& matchee) const { - const auto relMargin = m_epsilon * std::max(std::fabs(matchee), std::fabs(m_target)); + const auto relMargin = m_epsilon * (std::max)(std::fabs(matchee), std::fabs(m_target)); return marginComparison(matchee, m_target, std::isinf(relMargin)? 0 : relMargin); } |