Is there an easy way to set a non-fixed precision after decimal in c++ when converting floats to strings?
What std::setprecision( 2 ) does is:
1.00000 -> 1
1.23456 -> 1.2
12.3456 -> 12
12.3000 -> 12.3
What std::fixed adds to it is:
1.00000 -> 1.00
1.23456 -> 1.20
12.3456 -> 12.34
12.3000 -> 12.30
What I want to do is:
1.00000 -> 1
1.23456 -> 1.23
12.3456 -> 12.34
12.3000 -> 12.3