I'd like to format a float so that it has at most 3 fractional digits, but if the last fractional digit(s) are 0 then omit them.
input : expected output
1.1234 : 1.123
1.120 : 1.12
1.100 : 1.1
1.0 : 1
%.3f always gives 3 fractional digits (1f.format("%.3f") = "1.000")