diff --git a/src/LogarithmicIntegral.cpp b/src/LogarithmicIntegral.cpp index d5d661cc..3548c27f 100644 --- a/src/LogarithmicIntegral.cpp +++ b/src/LogarithmicIntegral.cpp @@ -227,7 +227,7 @@ int64_t Li(int64_t x) { #if defined(HAVE_FLOAT128) double long_double_mantissa_bits = std::numeric_limits::digits; - if (x > 1e10 && std::log2(x) >= long_double_mantissa_bits - 3) + if (x > 1e10 && std::log2(x) >= long_double_mantissa_bits - 4) return (int64_t) ::Li((__float128) x); #endif return (int64_t) ::Li((long double) x); @@ -239,10 +239,10 @@ int64_t Li_inverse(int64_t x) if (x > 1e10) { double logx = std::log(x); - double n = (double) x * logx * logx * logx; + double n = (double) x * logx * logx; double long_double_mantissa_bits = std::numeric_limits::digits; - if (std::log2(n) >= long_double_mantissa_bits) + if (std::log2(n) >= long_double_mantissa_bits - 4) { __float128 res = ::Li_inverse((__float128) x); if (res > (__float128) std::numeric_limits::max()) @@ -266,7 +266,7 @@ int128_t Li(int128_t x) { #if defined(HAVE_FLOAT128) double long_double_mantissa_bits = std::numeric_limits::digits; - if (x > 1e10 && std::log2(x) >= long_double_mantissa_bits - 3) + if (x > 1e10 && std::log2(x) >= long_double_mantissa_bits - 4) return (int128_t) ::Li((__float128) x); #endif return (int128_t) ::Li((long double) x); @@ -278,10 +278,10 @@ int128_t Li_inverse(int128_t x) if (x > 1e10) { double logx = std::log(x); - double n = (double) x * logx * logx * logx; + double n = (double) x * logx * logx; double long_double_mantissa_bits = std::numeric_limits::digits; - if (std::log2(n) >= long_double_mantissa_bits) + if (std::log2(n) >= long_double_mantissa_bits - 4) { __float128 res = ::Li_inverse((__float128) x); if (res > (__float128) std::numeric_limits::max()) diff --git a/src/RiemannR.cpp b/src/RiemannR.cpp index 922539d8..3790032c 100644 --- a/src/RiemannR.cpp +++ b/src/RiemannR.cpp @@ -551,7 +551,7 @@ int64_t RiemannR(int64_t x) { #if defined(HAVE_FLOAT128) double long_double_mantissa_bits = std::numeric_limits::digits; - if (x > 1e10 && std::log2(x) >= long_double_mantissa_bits - 3) + if (x > 1e10 && std::log2(x) >= long_double_mantissa_bits - 4) return (int64_t) ::RiemannR((__float128) x); #endif return (int64_t) ::RiemannR((long double) x); @@ -563,10 +563,10 @@ int64_t RiemannR_inverse(int64_t x) if (x > 1e10) { double logx = std::log(x); - double n = (double) x * logx * logx * logx; + double n = (double) x * logx * logx; double long_double_mantissa_bits = std::numeric_limits::digits; - if (std::log2(n) >= long_double_mantissa_bits) + if (std::log2(n) >= long_double_mantissa_bits - 4) { __float128 res = ::RiemannR_inverse((__float128) x); if (res > (__float128) std::numeric_limits::max()) @@ -590,7 +590,7 @@ int128_t RiemannR(int128_t x) { #if defined(HAVE_FLOAT128) double long_double_mantissa_bits = std::numeric_limits::digits; - if (x > 1e10 && std::log2(x) >= long_double_mantissa_bits - 3) + if (x > 1e10 && std::log2(x) >= long_double_mantissa_bits - 4) return (int128_t) ::RiemannR((__float128) x); #endif return (int128_t) ::RiemannR((long double) x); @@ -602,10 +602,10 @@ int128_t RiemannR_inverse(int128_t x) if (x > 1e10) { double logx = std::log(x); - double n = (double) x * logx * logx * logx; + double n = (double) x * logx * logx; double long_double_mantissa_bits = std::numeric_limits::digits; - if (std::log2(n) >= long_double_mantissa_bits) + if (std::log2(n) >= long_double_mantissa_bits - 4) { __float128 res = ::RiemannR_inverse((__float128) x); if (res > (__float128) std::numeric_limits::max())