3 #include <cl_integer.h>
4 #include <cl_integer_io.h>
11 int main (int argc, char * argv[])
16 if (!strcmp(argv[1],"-r")) {
17 repetitions = atoi(argv[2]);
21 if (!strcmp(argv[1],"-n")) {
22 digits = atoi(argv[2]);
31 fprint(cl_stderr, "Number of digits: ");
32 fprintdecimal(cl_stderr, digits);
33 fprint(cl_stderr, "\n");
34 fprint(cl_stderr, "Number of repetitions: ");
35 fprintdecimal(cl_stderr, repetitions);
36 fprint(cl_stderr, "\n");
38 cl_float_format_t prec = cl_float_format(digits);
39 cl_float_format_t prec2 = cl_float_format(digits*2);
40 cl_I pow = expt_pos(10,digits);
41 cl_I x1 = floor1((sqrt(cl_float(5,prec2))+1)/2 * expt_pos(pow,2));
42 cl_I x2 = floor1(sqrt(cl_float(3,prec)) * pow);
45 fprint(cl_stderr, "multiplication\n");
48 for (int rep = repetitions; rep > 0; rep--)
51 cout << r << endl << endl;
54 fprint(cl_stderr, "division\n");
55 { cl_I_div_t qr = floor2(x1,x2);
57 for (int rep = repetitions; rep > 0; rep--)
58 { qr = floor2(x1,x2); }
60 cout << qr.quotient << endl << qr.remainder << endl << endl;
63 fprint(cl_stderr, "isqrt\n");
66 for (int rep = repetitions; rep > 0; rep--)
69 cout << r << endl << endl;
72 fprint(cl_stderr, "gcd\n");
73 { cl_I r = gcd(x1,x2);
75 for (int rep = repetitions; rep > 0; rep--)
78 cout << r << endl << endl;