Produces:for(my $i = 5.5; $i < 7; $i += .1) { if($i > 6.8) { printf "%f\n", $i; print "$i\n"; } }
But if I change the %f in the printf to %.14f, I get 6.99999999999999 instead of 7.0000. What gives? Seems like I shouldn't ever get 6.9999 when adding .1 to 6.9...6.900000 6.9 7.000000 6.99999999999999
In reply to weird print behavior by anjiro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |