|
-
May 21st, 2011, 07:33 PM
#1
floating point number formatting question
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"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|