Why don't I get zero when I subtract the same floating point number from itself in Perl? [duplicate]
Possible Duplicates: Why is floating point arithmetic in C# imprecise? Why does ghci say that 1.1 + 1.1 + 1.1 > 3.3 is True? #!/usr/bin/perl $l1 = "0+0.590580+0.583742+0.579787+0.564928+0.504538+0.459805+0.433273+0.384211+0.3035810"; $l2 = "0+0.590580+0.583742+0.579788+0.564928+0.504538+0.459805+0.433272+0.384211+0.3035810"; $val1 = eval ($l1); $val2 = eval ($l2); $diff = (($val1 - $val2)/$val1)*100; print " (($val1 - $val2)/$val1)*100 ==> $diff\n"; Surprisingly the output ended up to be ((4.404445 - 4.404445)/4.404445)*100 ==> -2.01655014354845e-14. Is it not supposed to be a ZERO???? Can any