4 #include <cl_float_io.h>
11 int main (int argc, char * argv[])
14 if ((argc >= 3) && !strcmp(argv[1],"-r")) {
15 repetitions = atoi(argv[2]);
21 uintL len = atoi(argv[1]);
22 extern cl_LF compute_pi_brent_salamin (uintC len);
23 extern cl_LF compute_pi_brent_salamin_quartic (uintC len);
24 extern cl_LF compute_pi_ramanujan_163 (uintC len);
25 extern cl_LF compute_pi_ramanujan_163_fast (uintC len);
28 for (int rep = repetitions; rep > 0; rep--)
29 { p = compute_pi_brent_salamin(len); }
33 for (int rep = repetitions; rep > 0; rep--)
34 { p = compute_pi_brent_salamin_quartic(len); }
38 for (int rep = repetitions; rep > 0; rep--)
39 { p = compute_pi_ramanujan_163(len); }
43 for (int rep = repetitions; rep > 0; rep--)
44 { p = compute_pi_ramanujan_163_fast(len); }
48 // Here the argument is N *decimal* digits, not N*32 bits!
49 int n = atoi(argv[1]);
50 cl_float_format_t prec = cl_float_format(n);
52 fprint(cl_stderr, "Computing pi\n");
53 { CL_TIMING; p = cl_pi(prec); }
54 fprint(cl_stderr, "Converting pi to decimal\n");
55 { CL_TIMING; cout << p << endl << endl; }