double d = 8.19999999999999999999;
cout << d << "\n";
cout << fixed << d << "\n";
cout << setprecision(15) << d << "\n";
cout << fixed << setprecision(15) << d << "\n";
输出
8.2
8.200000
8.199999999999999
8.199999999999999
我可以更改它以便打印
8.2
8.200000
8.200000000000000
8.200000000000000
代替?