]> www.ginac.de Git - cln.git/blob - tests/timeLFsin.cc
Fix double_approx(const cl_RA& x) on 64-Bit platforms.
[cln.git] / tests / timeLFsin.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
17 int main (int argc, char * argv[])
18 {
19         int repetitions = 1;
20         if ((argc >= 3) && !strcmp(argv[1],"-r")) {
21                 repetitions = atoi(argv[2]);
22                 argc -= 2; argv += 2;
23         }
24         if (argc < 2)
25                 exit(1);
26         extern int cl_sin_algo;
27         uintL len = atoi(argv[1]);
28 #if 0
29         cl_LF one = cl_I_to_LF(1,len);
30         cl_F x = scale_float(random_F(one),-1);
31         cout << x << endl;
32 #else
33         cl_F x = sqrt(cl_I_to_LF(2,len))-1;
34 #endif
35         cl_F y;
36 #if 0
37         cl_sin_algo = 0;
38         { CL_TIMING;
39           for (int rep = repetitions; rep > 0; rep--)
40             { y = sin(x); }
41         }
42         cout << y << endl;
43         cl_sin_algo = 1;
44 #endif
45         { CL_TIMING;
46           for (int rep = repetitions; rep > 0; rep--)
47             { y = sin(x); }
48         }
49         cout << y << endl;
50 }