From 8a8f4825a3eb93276f7e693c3c597619a7c6c1e5 Mon Sep 17 00:00:00 2001 From: Alex Dewar Date: Thu, 2 May 2024 14:46:57 +0100 Subject: [PATCH] Fix: isnan() shouldn't cause FP exceptions Fixes #3948. --- include/fmt/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index f4b2c53d13b3..95df0ad00d3b 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2695,7 +2695,7 @@ FMT_CONSTEXPR20 auto write_float(OutputIt out, const DecimalFP& f, } template constexpr auto isnan(T value) -> bool { - return !(value >= value); // std::isnan doesn't support __float128. + return value != value; // std::isnan doesn't support __float128. } template