Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
GMP ライブラリの MPQ 変数で get_d() を呼び出すと、最大で 6 桁しか取得できません。
C++ は、double に対して 8 バイトまたは ~15 桁を提供することになっています。6 桁しか表示されないのはなぜですか?
6桁が標準だった理由がわかりました -
デフォルトでは、cout を使用して C++ で double を出力する場合、精度は有効数字 6 桁に設定されます。この精度は、次のように変更できます。
double bignumber = 12.32576158213; cout << setprecision(10); cout << bignumber << endl;
出力は 12.32576158 になります。