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