diff options
author | Victor Zverovich <victor.zverovich@gmail.com> | 2016-11-14 20:14:52 -0800 |
---|---|---|
committer | Victor Zverovich <victor.zverovich@gmail.com> | 2016-11-14 20:14:52 -0800 |
commit | def687462c32ec40757e49eb6069f109d50236d6 (patch) | |
tree | d595c5ef2f07f02b6ce5a1482c413fc72f0aff4a | |
parent | 25f8ad13ddc6920f81f82853f724cf380871ff03 (diff) | |
download | fmtlib-def687462c32ec40757e49eb6069f109d50236d6.tar.gz |
Fix signbit detection (#423)
-rw-r--r-- | fmt/format.h | 4 |
1 files changed, 3 insertions, 1 deletions
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<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; |