]> www.ginac.de Git - cln.git/blob - tests/timeLFatan.cc
tests: #include <iostream> and using namespace std; for std::cout and std::endl
[cln.git] / tests / timeLFatan.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         extern int cl_atan_algo;
26         uintL len = atoi(argv[1]);
27 #if 0
28         cl_LF one = cl_I_to_LF(1,len);
29         cl_F x = scale_float(random_F(one),-1);
30         cout << x << endl;
31 #else
32         cl_F x = sqrt(cl_I_to_LF(2,len))-1;
33 #endif
34         cl_F y;
35 #if 0
36         cl_atan_algo = 0;
37         { CL_TIMING;
38           for (int rep = repetitions; rep > 0; rep--)
39             { y = atan(x); }
40         }
41         cout << y << endl;
42         cl_atan_algo = 1;
43 #endif
44         { CL_TIMING;
45           for (int rep = repetitions; rep > 0; rep--)
46             { y = atan(x); }
47         }
48         cout << y << endl;
49 }