develooper Front page | perl.perl5.porters | Postings from October 2003

[perl #24092] sprintf problem

Thread Next
From:
Alex
Date:
October 4, 2003 11:08
Subject:
[perl #24092] sprintf problem
Message ID:
rt-24092-65578.4.64277502595863@rt.perl.org
# New Ticket Created by  Alex 
# Please include the string:  [perl #24092]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=24092 >


Hello guys,

I try to round 1.045 on my Perl (v5.6.1) but output is very strange:
perl -e "print sprintf('%.2f', '1.045')"
1.04
perl -e "print sprintf('%.2f', '1.0451')"
1.05
Is it the bug?
Thanks.

---
Alex


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About