1 #include <cln/number.h>
3 #include <cln/integer.h>
4 #include <cln/integer_io.h>
9 #include <cln/timing.h>
14 int main (int argc, char * argv[])
19 if (!strcmp(argv[1],"-r")) {
20 repetitions = atoi(argv[2]);
24 if (!strcmp(argv[1],"-n")) {
25 digits = atoi(argv[2]);
34 stderr << "Number of digits: " << digits << endl;
35 stderr << "Number of repetitions: " << repetitions << endl;
37 float_format_t prec = float_format(digits);
38 float_format_t prec2 = float_format(digits*2);
39 cl_I pow = expt_pos(10,digits);
40 cl_I x1 = floor1((sqrt(cl_float(5,prec2))+1)/2 * expt_pos(pow,2));
41 cl_I x2 = floor1(sqrt(cl_float(3,prec)) * pow);
44 stderr << "multiplication" << endl;
47 for (int rep = repetitions; rep > 0; rep--)
50 cout << r << endl << endl;
53 stderr << "division" << endl;
54 { cl_I_div_t qr = floor2(x1,x2);
56 for (int rep = repetitions; rep > 0; rep--)
57 { qr = floor2(x1,x2); }
59 cout << qr.quotient << endl << qr.remainder << endl << endl;
62 stderr << "isqrt" << endl;
65 for (int rep = repetitions; rep > 0; rep--)
68 cout << r << endl << endl;
71 stderr << "gcd" << endl;
72 { cl_I r = gcd(x1,x2);
74 for (int rep = repetitions; rep > 0; rep--)
77 cout << r << endl << endl;