diff --git a/ex-2/fast.c b/ex-2/fast.c index 22a2b33..da72e7b 100644 --- a/ex-2/fast.c +++ b/ex-2/fast.c @@ -2,6 +2,7 @@ #include #include #include +#include /* The Euler-Mascheroni constant is here computed to * arbitrary precision using GMP floating point numbers @@ -216,7 +217,12 @@ int main(int argc, char** argv) { mpf_set_default_prec(prec + 64); mpf_t y; mpf_init(y); + + clock_t begin = clock(); mpf_gamma(y, digits); + clock_t end = clock(); + double time = (double)(end - begin)/CLOCKS_PER_SEC; + fprintf(stderr, "[main] running time: %gs\n", time); // again, trick to avoid rounding gmp_printf("%.*Ff\b \n", digits+1, y);