Fix signbit detection (#423)

This commit is contained in:
Victor Zverovich 2018-01-21 16:41:55 -08:00
parent 5e4c34b25a
commit 3a6c7d0cbd

View File

@ -254,8 +254,10 @@ class numeric_limits<fmt::internal::dummy_int> :
// 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;