From 3a6c7d0cbd94f32bb66d4ada21894dc122a9b2d4 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 21 Jan 2018 16:41:55 -0800 Subject: [PATCH] Fix signbit detection (#423) --- include/fmt/format.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 6ffae2d9..930dfae8 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -254,8 +254,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;