in reply to Is this odd behavior a floating point problem?
For reasons described in excruciating detail in the document already cited, there will be errors, but according to a quick test on my system, they are nowhere near as large as you claim:
$ perl -e '$x=0.001; $sum += $x for 1..40; printf "%.20f", $sum/40' 0.00100000000000000067
Looks more like a "one off" error to me (i.e. summing over one more than you divide by):
$ perl -e '$x=0.001; $sum += $x for 0..40; printf "%.20f", $sum/40' 0.00102500000000000074
In Section
Seekers of Perl Wisdom