in reply to Re: Reduce from 2 to 0.1.
in thread Reduce from 2 to 0.1.
Solution: round it off with sprintf.
Not actually a very good solution as this test shows:
#!/usr/bin/perl -w use strict; for (my $i = 2 ; $i >= 0.1 ; $i -= 0.1){ printf "%.1f\n", $i; }
The output is:
2.0 1.9 1.8 1.7 1.6 1.5 1.4 1.3 1.2 1.1 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2
Note that 0.1 is not printed, contrary to what you'd expect if you were reading the condition in the code.
You'd probably need to adjust the condition to take this into account.
--
"Perl makes the fun jobs fun
and the boring jobs bearable" - me
|
|---|