The difference between IDL and numpy is that IDL uses single precision floats by default while numpy uses doubles. If you try it with doubles in IDL, you will see that it also returns false.
As David Cournapeau said, you should not expect different floating point arithmetic operations to give exactly the same result. It's just luck if they do. E.g., in IDL you'll find that 0.1+0.6 is not equal to 0.7. That's because 0.1 and 0.6 are not exactly representable as floats. On Nov 4, 2009, Jean-Luc Menut wrote: > Hello all, > > > > If if define 2 variables a and b by doing the following : > > on [5]: a > Out[5]: array([ 1.7]) > > In [6]: b=array([0.8])+array([0.9]) > > In [7]: b > Out[7]: array([ 1.7]) > > > if I test the equality of a and b, instead to obatin True, I have : > In [8]: a==b > Out[8]: array([False], dtype=bool) > > I know it not related only to numpy but also to python. > How do you tackle this problem ? > > (I also tried on IDL and it works well : I guess it truncate the > number). > > Thanks , > > Jean-Luc _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion