Depending on the initial value of $i, it adds 0.09 at a different point.#!/usr/bin/perl use warnings; use strict; for (my $i = 0 ; $i < 9 ; $i += 0.1){ print "$i\n"; } OUTPUT (truncated): (...) 4.9 5 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.99999999999999 6.09999999999999 6.19999999999999 6.29999999999999 6.39999999999999 6.49999999999999 (...)
In reply to for loop with float by RobertCraven
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |