Any integer + .005 is not going to be exactly representable in floating point. Sometimes you are getting a repesentable value above the true one and sometimes one below. Try this:
for my $num ( 0 .. 101 ) {
$num += 0.005;
printf "%.2f\t%.20g\n", $num, $num;
}
to see the actual values you are rounding and it should
make more sense. (The output starts:)
0.01 0.0050000000000000001041
1.00 1.0049999999999998934
2.00 2.0049999999999998934
3.00 3.0049999999999998934
4.00 4.0049999999999998934
5.00 5.0049999999999998934
6.00 6.0049999999999998934
7.00 7.0049999999999998934
8.01 8.0050000000000007816
9.01 9.0050000000000007816
10.01 10.005000000000000782
11.01 11.005000000000000782
12.01 12.005000000000000782
13.01 13.005000000000000782
14.01 14.005000000000000782
15.01 15.005000000000000782
16.00 16.004999999999999005