[Numpy-discussion] Different results from repeated calculation

Robert Kern robert.kern at gmail.com
Mon Jan 29 14:03:08 CST 2007


Keith Goodman wrote:
> On 1/29/07, Keith Goodman <kwgoodman at gmail.com> wrote:
>> On 1/29/07, Keith Goodman <kwgoodman at gmail.com> wrote:
>>> On 1/29/07, Charles R Harris <charlesr.harris at gmail.com> wrote:
>>>
>>>> That's odd, the LSB bit of the  double precision mantissa is only about
>>>> 2.2e-16, so  you can't *get* differences as  small as 8.4e-22 without about
>>>> 70 bit mantissa's. Hmmm, and extended double precision only has 63 bit
>>>> mantissa's. Are you sure you are computing the error correctly?
>>> That is odd.
>>>
>>> 8.4e-22 is just the output of the test script: abs(z - z0).max(). That
>>> abs is from python.
>> By playing around with x and y I can get all sorts of values for abs(z
>> - z0).max(). I can get down to the e-23 range and to 2.2e-16. I've
>> also seen e-18 and e-22.
> 
> Here is a setting for x and y that gives me a difference (using the
> unit test in this thread) of 4.54747e-13! That is huge---and a serious
> problem. I am sure I can get bigger.

Check the size of z0. Only the relative difference abs((z-z0)/z0) is going to be
about 1e-16. If you adjust the size of z0, the absolute difference will also
change in size. In the original unittest that you wrote, z0 is about 1e-6, so
1e-22 corresponds to 1 ULP. With the data you give here, z0 is about 1e3, so
1e-13 also corresponds to 1 ULP.

There is no (additional) problem here.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco


More information about the Numpy-discussion mailing list