in reply to Decimal Increment Bug?

What Every Computer Scientist Should Know About Floating-Point Arithmetic

In short: repeated addition of ~0.1 is not the same as n instances of exactly 0.1.

Instead, do something like this:

use warnings; use strict; my $delta = 0.1; my $v = 0; my $i = 0; while( $v < 9 ) { $v = $i * $delta; print $v, $/; ++$i; }