]> www.ginac.de Git - cln.git/blob - tests/timeLFln.cc
Fix double_approx(const cl_RA& x) on 64-Bit platforms.
[cln.git] / tests / timeLFln.cc
1 #include <cln/number.h>
2 #include <cln/io.h>
3 #include <cln/float.h>
4 #include <cln/float_io.h>
5 #include <cln/lfloat.h>
6 #include "float/lfloat/cl_LF.h"
7 #include <cln/real.h>
8 #include <cln/random.h>
9 #include <cstdlib>
10 #include <cstring>
11 #include <cln/timing.h>
12 using namespace cln;
13 #include <iostream>
14 using namespace std;
15
16 int main (int argc, char * argv[])
17 {
18         int repetitions = 1;
19         if ((argc >= 3) && !strcmp(argv[1],"-r")) {
20                 repetitions = atoi(argv[2]);
21                 argc -= 2; argv += 2;
22         }
23         if (argc < 2)
24                 exit(1);
25         uintL len = atoi(argv[1]);
26 #if 0
27         cl_LF one = cl_I_to_LF(1,len);
28         cl_F x = one + random_F(one)/3;
29         cout << x << endl;
30 #else
31         cl_F x = sqrt(sqrt(cl_I_to_LF(2,len)));
32 #endif
33         cl_F y;
34         extern int cl_lnx_algo;
35         y = ln(x); // fill cache
36 #if 0
37         cl_lnx_algo = 0;
38         { CL_TIMING;
39           for (int rep = repetitions; rep > 0; rep--)
40             { y = ln(x); }
41         }
42         cout << y << endl;
43         cl_lnx_algo = 1;
44 #endif
45         { CL_TIMING;
46           for (int rep = repetitions; rep > 0; rep--)
47             { y = ln(x); }
48         }
49         cout << y << endl;
50 }