|
|
| The stupid question is the question not asked | |
| PerlMonks |
Re: Using (s)printf()by Anonymous Monk |
| on Aug 31, 2001 at 16:05 UTC ( #109360=note: print w/ replies, xml ) | Need Help?? |
|
I tried to use the example given in the text. This is what I get (using perl v5.6.1 built for cygwin):
printf("%.2f", 9.333333); This prints "9.33". Actually, this is what I expect, but the article says it should be 9.34.
If I try the following:
printf("%.1f", 9.55);
I get 9.6, which is OK, but if I try
printf("%.1f", 43.55); I get 43.5, which is rounded the wrong way. Can someone explain this? (Please send me an email (oz1lo001@sneakemail.com)).
In Section
Tutorials
|
|
||||||||||||||||||||||||||||||