]> www.ginac.de Git - cln.git/blob - tests/timesqrt.cc
34f564b8f02336d80f50dd8bb91496fb1117eb96
[cln.git] / tests / timesqrt.cc
1 #include <cln/number.h>
2 #include <cln/io.h>
3 #include <cln/integer.h>
4 #include <cln/random.h>
5 #include <stdlib.h>
6 #include <string.h>
7 #include <cln/timing.h>
8
9 int main (int argc, char * argv[])
10 {
11         int repetitions = 1;
12         if ((argc >= 3) && !strcmp(argv[1],"-r")) {
13                 repetitions = atoi(argv[2]);
14                 argc -= 2; argv += 2;
15         }
16         if (argc < 2)
17                 exit(1);
18         cl_I m1 = cl_I(argv[1]);
19         cl_I M1 = (cl_I)1 << (intDsize*m1);
20         cl_I a = abs(random_I(M1));
21         extern int cl_sqrt_algo;
22         { CL_TIMING;
23           for (int rep = repetitions; rep > 0; rep--)
24             { cl_I b; isqrt(a,&b); }
25         }
26 }