On 03/14/2007 11:19 AM, louis fridkis wrote:
Why does Perl say 10.2 is 10.19999999999
Here is example code and output:

#!/usr/bin/perl -w
$add = 10.2;
print "$add\n";
printf "$add\n";
printf ("%40.35f\n", $add);

perl  add1.pl
10.2
10.2
 10.19999999999999928945726423989981413

If you have the perldoc utility installed, do this to get the explanation of this behavior:

Start->Run-> perldoc -q "long decimals"




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to