Perl: the Markov chain saw | |
PerlMonks |
(s)printf and rounding woesby Not_a_Number (Prior) |
on Nov 04, 2003 at 22:25 UTC ( [id://304559]=perlquestion: print w/replies, xml ) | Need Help?? |
Not_a_Number has asked for the wisdom of the Perl Monks concerning the following question: Can anyone shed any light on this (I find the documentation for printf and sprintf to be particularly vague...):
Output: I get (using ASP 5.61, WinXP):
followed by seemingly random series of x.00 or x.01. Interestingly(?), if I change the number of decimals that I want to round to:
I get similarly strange results, but not for the same 'numbers' (eg I get 2.001 and 3.001, as compared with 2.00 and 3.00 in the first case Am I missing something (as usual)? tia, dave
Back to
Seekers of Perl Wisdom
|
|