Re: [Numpy-discussion] comparing floating point numbers

2010-07-21 Thread Pauli Virtanen
ke, 2010-07-21 kello 10:46 +0200, David Cournapeau kirjoitti: [clip: assert nulps] > I think we should go toward using those almost everywhere we need > floating point comparison in testing, I think we also need an assertion function that behaves like np.allclose -- the ULPs are somewhat unintuiti

Re: [Numpy-discussion] comparing floating point numbers

2010-07-21 Thread David Cournapeau
On Tue, Jul 20, 2010 at 3:31 AM, Ondrej Certik wrote: > Hi, > > I was always using something like > > abs(x-y) < eps > > or > > (abs(x-y) < eps).all() > > but today I needed to also make sure this works for larger numbers, > where I need to compare relative errors, so I found this: > > http://www.

Re: [Numpy-discussion] comparing floating point numbers

2010-07-21 Thread Ondrej Certik
Hi Keith! On Mon, Jul 19, 2010 at 6:40 PM, Keith Goodman wrote: > On Mon, Jul 19, 2010 at 6:31 PM, Ondrej Certik wrote: >> Hi, >> >> I was always using something like >> >> abs(x-y) < eps >> >> or >> >> (abs(x-y) < eps).all() >> >> but today I needed to also make sure this works for larger numbe

Re: [Numpy-discussion] comparing floating point numbers

2010-07-19 Thread Keith Goodman
On Mon, Jul 19, 2010 at 6:31 PM, Ondrej Certik wrote: > Hi, > > I was always using something like > > abs(x-y) < eps > > or > > (abs(x-y) < eps).all() > > but today I needed to also make sure this works for larger numbers, > where I need to compare relative errors, so I found this: > > http://www.

[Numpy-discussion] comparing floating point numbers

2010-07-19 Thread Ondrej Certik
Hi, I was always using something like abs(x-y) < eps or (abs(x-y) < eps).all() but today I needed to also make sure this works for larger numbers, where I need to compare relative errors, so I found this: http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm and wrote thi