Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Mar 18, 2024
1 parent f2393d4 commit b1fcc59
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Changes in version 12.2, 18/03/2024

* RiemannR.cpp: Fix infinite loop on Linux i386,
see https://github.com/kimwalisch/primecount/issues/66.
* test/Riemann_R.cpp: Add more tests.

Changes in version 12.1, 09/03/2024
===================================
Expand Down
22 changes: 22 additions & 0 deletions test/Riemann_R.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@
using std::size_t;
using namespace primesieve;

/// Generated using Mathematica:
/// Table[IntegerPart[RiemannR[k]], {k, 0, 99}]
Array<uint64_t, 100> RiemannR_tiny =
{
0, 1, 1, 2, 2, 2, 3, 3, 3, 4,
4, 4, 5, 5, 5, 6, 6, 6, 6, 7,
7, 7, 8, 8, 8, 8, 9, 9, 9, 9,
10, 10, 10, 10, 11, 11, 11, 11, 12, 12,
12, 12, 13, 13, 13, 13, 14, 14, 14, 14,
14, 15, 15, 15, 15, 16, 16, 16, 16, 17,
17, 17, 17, 17, 18, 18, 18, 18, 18, 19,
19, 19, 19, 20, 20, 20, 20, 20, 21, 21,
21, 21, 21, 22, 22, 22, 22, 23, 23, 23,
23, 23, 24, 24, 24, 24, 24, 25, 25, 25
};

Array<uint64_t, 14> RiemannR_table =
{
4, // RiemannR(10^1)
Expand Down Expand Up @@ -47,6 +63,12 @@ void check(bool OK)

int main()
{
for (size_t x = 0; x < RiemannR_tiny.size(); x++)
{
std::cout << "RiemannR(" << x << ") = " << (uint64_t) RiemannR((long double) x);
check((uint64_t) RiemannR((long double) x) == RiemannR_tiny[x]);
}

uint64_t x = 1;
for (size_t i = 0; i < RiemannR_table.size(); i++)
{
Expand Down

0 comments on commit b1fcc59

Please sign in to comment.