ex-2/fast: print running time
This commit is contained in:
parent
383dbd6f38
commit
f2679b8204
@ -2,6 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <gmp.h>
|
||||
#include <time.h>
|
||||
|
||||
/* 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);
|
||||
|
Loading…
Reference in New Issue
Block a user