On Friday 14 September 2007 20:12, Charles R Harris wrote: > Since none of the numbers are exactly represented in IEEE floating > point, this sort of oddity is expected. If you look at the exact > values, (.4 + .2)/.1 > 6 and .6/.1 < 6 . That said, I would expect
You hit send too fast! The fractions that can be represented exactly in binary are: 1/2, 1/4, 1/8, ... and not 2/10, 4/10, 8/10 .... See here: In [1]:0.5 == .25+.25 Out[1]:True In [2]:.5 Out[2]:0.5 In [3]:.25 Out[3]:0.25 In [4]:.125 Out[4]:0.125 In [8]:.375 == .25 + .125 Out[8]:True Regards, Eike. _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion