tags:

views:

36

answers:

1

When I call get_d() on a MPQ variable in the GMP library, I only get at most six digits.

C++ is supposed to provide 8 bytes or ~15 digits for doubles. Why am I only getting six digits?

+1  A: 

I found out why six digits was standard -

by default, when outputting doubles in C++ using cout, the precision is set to six significant figures. You can modify this precision by doing the following:

double bignumber = 12.32576158213;
cout << setprecision(10);
cout << bignumber << endl;

The output will be 12.32576158.

Han