I would like to use boost::format to convert a float number to string.
These are several examples for the expected results:
0.5 -> "0.5"
0 -> "0"
1.00001 -> "1"
3.66 -> "3.7"
I am using currently
boost::format("%1$.1f")
it works mostly, but the result of 0 is "0.0" and 1.00001 is "1.0" when I want "0" and "1" instead.
What do I need to change to get rid of the pointless .0?
Use a conditional to choose between two formats.