dtoolbase: Fix bad double-prec NaN/inf detection in release build

Fixes #987
Closes #988
This commit is contained in:
LD 2020-08-11 21:36:39 +02:00 committed by rdb
parent c7341bec26
commit 9f0fc0a594

View File

@ -351,7 +351,7 @@ cnan(double v) {
#if __FINITE_MATH_ONLY__
// GCC's isnan breaks when using -ffast-math.
union { double d; uint64_t x; } u = { v };
return ((u.x << 1) > 0xff70000000000000ull);
return ((u.x << 1) > 0xffe0000000000000ull);
#elif !defined(_WIN32)
return std::isnan(v);
#else
@ -383,7 +383,7 @@ cinf(double v) {
#if __FINITE_MATH_ONLY__
// GCC's isinf breaks when using -ffast-math.
union { double d; uint64_t x; } u = { v };
return ((u.x << 1) == 0xff70000000000000ull);
return ((u.x << 1) == 0xffe0000000000000ull);
#elif !defined(_WIN32)
return std::isinf(v);
#else