Skip to content

Commit

Permalink
Rename primesApprox() to primePiApprox()
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Jan 8, 2024
1 parent c0ec864 commit 40ccd65
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/primesieve/nthPrimeApprox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ uint64_t Li(uint64_t x);
uint64_t Li_inverse(uint64_t x);
uint64_t Ri(uint64_t x);
uint64_t Ri_inverse(uint64_t x);
uint64_t primesApprox(uint64_t x);
uint64_t primePiApprox(uint64_t x);
uint64_t nthPrimeApprox(uint64_t n);

} // namespace
4 changes: 2 additions & 2 deletions src/nthPrime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ uint64_t PrimeSieve::nthPrime(int64_t n, uint64_t start)

setStart(start);
auto t1 = std::chrono::system_clock::now();
uint64_t nApprox = checkedAdd(primesApprox(start), n);
uint64_t nApprox = checkedAdd(primePiApprox(start), n);
nApprox = std::min(nApprox, max_n);
uint64_t primeApprox = nthPrimeApprox(nApprox);
primeApprox = std::max(primeApprox, start);
Expand Down Expand Up @@ -125,7 +125,7 @@ uint64_t PrimeSieve::negativeNthPrime(int64_t n, uint64_t start)

setStart(start);
auto t1 = std::chrono::system_clock::now();
uint64_t nApprox = checkedSub(primesApprox(start), n);
uint64_t nApprox = checkedSub(primePiApprox(start), n);
nApprox = std::min(nApprox, max_n);
uint64_t primeApprox = nthPrimeApprox(nApprox);
primeApprox = std::min(primeApprox, start);
Expand Down
2 changes: 1 addition & 1 deletion src/nthPrimeApprox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ uint64_t Ri_inverse(uint64_t x)
return (uint64_t) ::Ri_inverse((long double) x);
}

uint64_t primesApprox(uint64_t x)
uint64_t primePiApprox(uint64_t x)
{
// Li(x) is faster but less accurate than Ri(x).
// For small n speed is more important than accuracy.
Expand Down

0 comments on commit 40ccd65

Please sign in to comment.