Fix signbit detection (#423)

(cherry picked from commit def687462c)
This commit is contained in:
Victor Zverovich
2017-06-08 11:28:39 +02:00
committed by Jonathan Müller
parent b9a20d761a
commit baedba07ca
+3 -1
View File
@@ -397,8 +397,10 @@ class numeric_limits<fmt::internal::DummyInt> :
// 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;