1 /* This file is public domain. Author: Fredrik Johansson. */ 2 3 #include "arb.h" 4 #include "flint/profiler.h" 5 main(int argc,char * argv[])6int main(int argc, char *argv[]) 7 { 8 arb_t x; 9 slong prec, digits, condense; 10 11 if (argc < 2) 12 { 13 flint_printf("usage: build/examples/pi digits [condense = 20]\n"); 14 return 1; 15 } 16 17 digits = atol(argv[1]); 18 19 if (argc > 2) 20 condense = atol(argv[2]); 21 else 22 condense = 20; 23 24 arb_init(x); 25 26 prec = digits * 3.3219280948873623 + 5; 27 28 flint_printf("computing pi with a precision of %wd bits... ", prec); 29 30 TIMEIT_ONCE_START 31 arb_const_pi(x, prec); 32 TIMEIT_ONCE_STOP 33 34 SHOW_MEMORY_USAGE 35 36 arb_printn(x, digits, ARB_STR_CONDENSE * condense); 37 38 flint_printf("\n"); 39 40 arb_clear(x); 41 flint_cleanup(); 42 return 0; 43 } 44 45