in reply to While loop with addition goes weird
Computers are notoriously bad at computing with decimal numbers. That includes most programming languages.
If you want accurate arithmetic, you might want to try using Perl 6:
;-)> my $size = 0.01; 0.01 > my $step_size = 0.01; 0.01 > $size += $step_size while $size < 5; Nil > say "FINAL: $size"; FINAL: 5
In Section
Seekers of Perl Wisdom