From ef54f9aa3858d7d10591719615bce337fbe49c40 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 1 Apr 2022 11:18:19 -0700 Subject: [PATCH] Suppress -Wfloat-equal --- include/fmt/format.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 59b8077b..ac0e5aab 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2293,10 +2293,14 @@ FMT_CONSTEXPR20 auto write_float(OutputIt out, const DecimalFP& fp, } } +template constexpr bool isnan(T value) { + return !(value >= value); // std::isnan doesn't support __float128. +} + template ::value && !is_float128::value)> FMT_CONSTEXPR20 bool isfinite(T value) { - if (is_constant_evaluated()) return value - value == 0; + if (is_constant_evaluated()) return !isnan(value - value); return std::isfinite(value); } template ::value)> @@ -2304,10 +2308,6 @@ constexpr bool isfinite(T value) { return value - value == 0; // std::isfinite doesn't support __float128. } -template constexpr bool isnan(T value) { - return value != value; // std::isnan doesn't support __float128. -} - template ::value)> FMT_INLINE FMT_CONSTEXPR bool signbit(T value) { if (is_constant_evaluated()) {