]> www.ginac.de Git - cln.git/blob - tests/timeLFatanh.cc
- Threw out diversions into subdir gmp/.
[cln.git] / tests / timeLFatanh.cc
1 #include <cl_number.h>
2 #include <cl_io.h>
3 #include <cl_float.h>
4 #include <cl_lfloat.h>
5 #include "cl_LF.h"
6 #include <cl_complex.h>
7 #include <cl_complex_io.h>
8 #include <cl_real.h>
9 #include <cl_random.h>
10 #include <stdlib.h>
11 #include <string.h>
12 #include <cl_timing.h>
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         uintL len = atoi(argv[1]);
24 #if 0
25         cl_LF one = cl_I_to_LF(1,len);
26         cl_F x = scale_float(random_F(one),-1);
27         cout << x << endl;
28 #else
29         cl_F x = sqrt(cl_I_to_LF(2,len))-1;
30 #endif
31         cl_N y;
32         ln(cl_I_to_LF(1000,len+10)); // fill cache
33         { CL_TIMING;
34           for (int rep = repetitions; rep > 0; rep--)
35             { y = atanh(x); }
36         }
37         cout << y << endl;
38         { CL_TIMING;
39           for (int rep = repetitions; rep > 0; rep--)
40             { y = ln((1+x)/(1-x))/2; }
41         }
42         cout << y << endl;
43 }