开发者

Is GMP broken? It can't be done!

开发者 https://www.devze.com 2022-12-22 02:42 出处:网络
When I call get_d() on a MPQ v开发者_StackOverflow中文版ariable in the GMP library, I only get at most six digits.

When I call get_d() on a MPQ v开发者_StackOverflow中文版ariable 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消