From def687462c32ec40757e49eb6069f109d50236d6 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 14 Nov 2016 20:14:52 -0800 Subject: [PATCH] Fix signbit detection (#423) --- fmt/format.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fmt/format.h b/fmt/format.h index 9f0995ab..1ed934c1 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -397,8 +397,10 @@ class numeric_limits : // Portable version of signbit. static bool isnegative(double x) { using namespace fmt::internal; - if (const_check(sizeof(signbit(x)) == sizeof(int))) + if (const_check(sizeof(signbit(x)) == sizeof(bool) || + sizeof(signbit(x)) == sizeof(int))) { return signbit(x) != 0; + } if (x < 0) return true; if (!isnotanumber(x)) return false; int dec = 0, sign = 0;