]> www.ginac.de Git - cln.git/blob - tests/timeLFatanh.cc
Fix crashes in find_univpoly_ring and related functions
[cln.git] / tests / timeLFatanh.cc
1 #include <cln/number.h>
2 #include <cln/io.h>
3 #include <cln/float.h>
4 #include <cln/lfloat.h>
5 #include "cl_LF.h"
6 #include <cln/complex.h>
7 #include <cln/complex_io.h>
8 #include <cln/real.h>
9 #include <cln/random.h>
10 #include <cstdlib>
11 #include <cstring>
12 #include <cln/timing.h>
13 using namespace cln;
14
15 int main (int argc, char * argv[])
16 {
17         int repetitions = 1;
18         if ((argc >= 3) && !strcmp(argv[1],"-r")) {
19                 repetitions = atoi(argv[2]);
20                 argc -= 2; argv += 2;
21         }
22         if (argc < 2)
23                 exit(1);
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_N y;
33         ln(cl_I_to_LF(1000,len+10)); // fill cache
34         { CL_TIMING;
35           for (int rep = repetitions; rep > 0; rep--)
36             { y = atanh(x); }
37         }
38         cout << y << endl;
39         { CL_TIMING;
40           for (int rep = repetitions; rep > 0; rep--)
41             { y = ln((1+x)/(1-x))/2; }
42         }
43         cout << y << endl;
44 }