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