44int main(
int argc,
char *argv[]) {
51 fprintf(stderr,
"Usage: %s <num-digits> [<radix>]\n", argv[0]);
55 if ((ndigits =
abs(atoi(argv[1]))) == 0) {
56 fprintf(stderr,
"%s: you must request at least 1 digit\n", argv[0]);
59 fprintf(stderr,
"%s: you may request at most %u digits\n", argv[0],
65 int radix = atoi(argv[2]);
68 fprintf(stderr,
"%s: you may only specify a radix between %d and %d\n",
81 fprintf(stderr,
"%s: error computing arctan: %d\n", argv[0],
res);
88 fprintf(stderr,
"%s: error computing arctan: %d\n", argv[0],
res);
95 fprintf(stderr,
"%s: error computing pi: %d\n", argv[0],
res);
104 fprintf(stderr,
"Computation took %.2f sec.\n",
105 (
double)(end - start) / CLOCKS_PER_SEC);
void GMPQAPI() mul(mp_rat product, mp_rat multiplier, mp_rat multiplicand)
void GMPZAPI() abs(mp_int rop, mp_int op)
mp_result arctan(mp_small radix, mp_small mul, mp_small x, mp_small prec, mp_int sum)
#define mp_int_compare_zero
#define mp_int_expt_value