I want to output the value of a double in it's full precision. However, when using the cout function, it only displays the first 6 digits even though there is around 15-16 digits of precision.
How do I get my program to display the entire value, including the magnitude (power) component?
Use the setprecision()
manipulator:
http://www.cplusplus.com/reference/iostream/manipulators/setprecision/
You can also force scientific notation with the scientific
manipulator:
http://www.cplusplus.com/reference/iostream/manipulators/scientific/
cout << scientific << setprecision(15) << my_number << endl;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With