[Chicago-talk] addition weirdness

Whitney Jackson wjackson at laughingman.net
Thu Jan 29 09:39:48 CST 2004

When I run :


$total = 0;
while (<>) {
  $total += $_;
print "$total\n";

with a file full of numbers (http://laughingman.net/numbers.txt) as 
input I get 2752872.74999999.  Strangely the file only contains numbers 
with two digits after the decimal point.  Other number lists (including 
this same file without its last line) produce normal results.

Any idea why this is happening?


More information about the Chicago-talk mailing list