http://www.perlmonks.org?node_id=109360


in reply to Using (s)printf()

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)).