good chemistry is complicated, and a little bit messy LW 

PerlMonks 
Re: Simple adding numbersby davido (Archbishop) 
on Mar 25, 2013 at 23:53 UTC ( #1025418=note: print w/ replies, xml )  Need Help?? 
This is the result of storing floating point numbers in base two. Consider the fraction 1/3rd. Expressed in decimal, that's 0.33 (repeating forever). Add 0.33 three times, and you get 0.99, not one. You can extend to as many decimal places as you like, you'll never get .3333333333333333333333333 * 3 to add up to 1.0. Well, in base 2, the fraction 1/10th has a nonterminating expansion. So 0.1 has to be stored as 0.09999999999999999 or something similar, and when you add that up ten times you won't get to one. Of course this is not unique to Perl. Consider the following C++ code:
...outputs...
Dave
In Section
Seekers of Perl Wisdom

