[Matrix-SIG] possible bug in NumPy

Rob Hooft R.Hooft@EuroMail.com
Tue, 5 May 1998 16:47:21 +0200 (MET DST)


 OG> >>>abs(a-b)
 OG> array([[0.1,0.1],
 OG>        [0.1,0.1]])
 OG> >>>less_equal(abs(a-b),c)
 OG> array([[0, 0],
 OG>        [0, 0]])

>>> abs(a-b)-c
array([[  8.32667268e-17,   8.32667268e-17],
       [  8.32667268e-17,   8.32667268e-17]])

i.e. They are not equal, and the Numpy comparison answers are correct.

Never rely on equality of floating point numbers if they are the result
of a computation.

Regards,
-- 
=====       R.Hooft@EuroMail.com   http://www.Sander.EMBL-Heidelberg.DE/rob/ ==
=====       R&D, Nonius BV, Delft  http://www.nonius.com/                    ==
===== PGPid 0xFA19277D ========================== Use Linux! ==================