I'm trying out GMP/MPIR with VS 2010, I don't understand why the output is 0.999999999999999999909e101 for input 10 10.
I'd expect all the digits to show because i put 1000 for n_digits in mpf_out_str call, using 0 same result. And why the 9's, and 909e101?
Also how would you input huge numbers, gmp_scanf doesn't seem to handle 100's of digits.
#include <mpirxx.h>
main()
{
mpf_t tt, t2;
mpf_init(tt);
mpf_init(t2);
gmp_scanf("%Fe\n", tt);
gmp_scanf("%Fe\n", t2);
for (int i = 0; i < 100; i++)
mpf_mul(tt, tt, t2);
mpf_out_str(stdout, 10, 1000, tt);
mpf_clear(tt);
mpf_clear(t2);
getc(stdin);
}
You need to specify the precision of an mpf_t. See mpf_init2() and mpf_set_default_prec().