]> www.ginac.de Git - cln.git/blob - tests/timezeta3.cc
Fix configury (intptr_t test) for cross-compilation.
[cln.git] / tests / timezeta3.cc
1 #include <cln/number.h>
2 #include <cln/io.h>
3 #include <cln/float.h>
4 #include <cln/real.h>
5 #include <cstdlib>
6 #include <cstring>
7 #include <cln/timing.h>
8 #include "float/lfloat/cl_LF.h"
9 namespace cln
10 {
11 // FIXME: don't use internal functions.
12 extern cl_LF zeta (int s, uintC len);
13 extern cl_LF compute_zeta_exp (int s, uintC len);
14 extern cl_LF compute_zeta_cvz1 (int s, uintC len);
15 extern cl_LF compute_zeta_cvz2 (int s, uintC len);
16 extern cl_LF zeta3 (uintC len);
17 }
18 using namespace cln;
19 #include <iostream>
20 using namespace std;
21
22 int main (int argc, char * argv[])
23 {
24         int repetitions = 1;
25         if ((argc >= 3) && !strcmp(argv[1],"-r")) {
26                 repetitions = atoi(argv[2]);
27                 argc -= 2; argv += 2;
28         }
29         if (argc < 2)
30                 exit(1);
31         uintL len = atoi(argv[1]);
32         cl_LF p;
33         ln(cl_I_to_LF(1000,len+10)); // fill cache
34         { CL_TIMING;
35           for (int rep = repetitions; rep > 0; rep--)
36             { p = compute_zeta_exp(3,len); }
37         }
38         cout << p << endl;
39         { CL_TIMING;
40           for (int rep = repetitions; rep > 0; rep--)
41             { p = compute_zeta_cvz1(3,len); }
42         }
43         cout << p << endl;
44         { CL_TIMING;
45           for (int rep = repetitions; rep > 0; rep--)
46             { p = compute_zeta_cvz2(3,len); }
47         }
48         cout << p << endl;
49         { CL_TIMING;
50           for (int rep = repetitions; rep > 0; rep--)
51             { p = zeta3(len); }
52         }
53         cout << p << endl;
54 }