Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Feb 17, 2024
1 parent 9e140d3 commit b06bbaf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/LogarithmicIntegral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,9 @@ int64_t Li_inverse(int64_t x)
{
double logx = std::log(x);
double n = (double) x * logx * logx * logx;
double long_double_mantissa_bits = std::numeric_limits<long double>::digits;

if (std::log2(n) >= std::numeric_limits<long double>::digits)
if (std::log2(n) >= long_double_mantissa_bits)
{
__float128 res = ::Li_inverse((__float128) x);
if (res > (__float128) std::numeric_limits<int64_t>::max())
Expand Down Expand Up @@ -278,8 +279,9 @@ int128_t Li_inverse(int128_t x)
{
double logx = std::log(x);
double n = (double) x * logx * logx * logx;
double long_double_mantissa_bits = std::numeric_limits<long double>::digits;

if (std::log2(n) >= std::numeric_limits<long double>::digits)
if (std::log2(n) >= long_double_mantissa_bits)
{
__float128 res = ::Li_inverse((__float128) x);
if (res > (__float128) std::numeric_limits<int128_t>::max())
Expand Down
6 changes: 4 additions & 2 deletions src/RiemannR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,9 @@ int64_t RiemannR_inverse(int64_t x)
{
double logx = std::log(x);
double n = (double) x * logx * logx * logx;
double long_double_mantissa_bits = std::numeric_limits<long double>::digits;

if (std::log2(n) >= std::numeric_limits<long double>::digits)
if (std::log2(n) >= long_double_mantissa_bits)
{
__float128 res = ::RiemannR_inverse((__float128) x);
if (res > (__float128) std::numeric_limits<int64_t>::max())
Expand Down Expand Up @@ -602,8 +603,9 @@ int128_t RiemannR_inverse(int128_t x)
{
double logx = std::log(x);
double n = (double) x * logx * logx * logx;
double long_double_mantissa_bits = std::numeric_limits<long double>::digits;

if (std::log2(n) >= std::numeric_limits<long double>::digits)
if (std::log2(n) >= long_double_mantissa_bits)
{
__float128 res = ::RiemannR_inverse((__float128) x);
if (res > (__float128) std::numeric_limits<int128_t>::max())
Expand Down

0 comments on commit b06bbaf

Please sign in to comment.