Can someone explain why there is a difference in behavior here?
perl -E 'say sprintf("%.2f",5.555);'
5.55
perl -E 'say sprintf("%.2f",0.555);'
0.56
I have read that sprintf()
rounds up if the following digits is 5 or greater. So why doesn't it round up to 0.56 in the second case?