Hi everyone:

Say, if I want to format a floating point number pretty much like it's done in mathematics (see example below). I do not need precision of more than two decimal numbers. Is there a printf formatting specifier that can do this?

Examples:

1.0000 becomes "1"
1.30 becomes "1.3"
1.32 becomes "1.32"
1.38 becomes "1.38"
1.322 becomes "1.32"
1.325 becomes "1.33"