I'm displaying a table of floating point numbers with setprecision(5). If the number is "1.25" it will display "1.2500" which is what I want. However, if the number is "0.25" it will display "0.25000"
How can I make numbers with a base number of zero display properly?
1) setprecision will not show trailing zeroes, you are probably have std::fixed too
2) Now it works exactly like it should: prints 5 significant digits.
3) To have behavior you want, you can:
* detect leading zero and change precision before each output
* print number into stringstream and then print exact number of characters you want
* write your own print function.