Commit baedba07 authored by Victor Zverovich's avatar Victor Zverovich Committed by Jonathan Müller

Fix signbit detection (#423)

(cherry picked from commit def68746)
parent b9a20d76
...@@ -397,8 +397,10 @@ class numeric_limits<fmt::internal::DummyInt> : ...@@ -397,8 +397,10 @@ class numeric_limits<fmt::internal::DummyInt> :
// Portable version of signbit. // Portable version of signbit.
static bool isnegative(double x) { static bool isnegative(double x) {
using namespace fmt::internal; 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; return signbit(x) != 0;
}
if (x < 0) return true; if (x < 0) return true;
if (!isnotanumber(x)) return false; if (!isnotanumber(x)) return false;
int dec = 0, sign = 0; int dec = 0, sign = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment