http://qs321.pair.com?node_id=321592

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks:
The following code results in a loss of zero padding to the right of the decimal.
code snippet below:
my $i=0; while ($i <=100){ $i=sprintf("%3.2f",$i); $i=$i+0.01; print "$i\n"; }
Snippet of the Actual Output:
99.9 99.91 99.92 99.93 99.94 99.95 99.96 99.97 99.98 99.99 100
What I would like to see is:
99.90 99.91 99.92 99.93 99.94 99.95 99.96 99.97 99.98 99.99 100.00
What subtlety am I missing?
I am running Active Perl 5.8.2 Build 808 on Windows 2000.
Thanks.