[Numpy-discussion] test failure in numpy trunk

Pauli Virtanen pav at iki.fi
Tue Mar 24 15:12:01 EDT 2009


Tue, 24 Mar 2009 13:15:21 -0400, Darren Dale wrote:
> I just performed an svn update, deleted my old build/ and
> site-packages/numpy*, reinstalled, and I see a new test failure on a 64
> bit linux machine:
> 
> ======================================================================
> FAIL: test_umath.TestComplexFunctions.test_loss_of_precision_longcomplex
> ----------------------------------------------------------------------
[clip]
>   "/usr/lib64/python2.6/site-packages/numpy/core/tests/test_umath.py",
> line 497, in check
>     'arctanh')
> AssertionError: (135, 3.4039637354191726288e-09,
> 3.9031278209478159624e-18, 'arctanh')

I can reproduce this (on another 64-bit machine). This time around, it's 
the real function that is faulty:

>>> x = np.longdouble(3e-9)
>>> np.arctanh(x+0j).real - x
9.0876776281460559983e-27
>>> np.arctanh(x).real - x
0.0
>>> np.finfo(np.longdouble).eps * x
3.2526065174565132804e-28

So, the system atanhl is ~ 30 relative eps away from the correct answer:

>>> from sympy import mpmath
>>> mpmath.mp.dps=60
>>> p = mpmath.mpf('3e-9')
>>> print (mpmath.atanh(p) - p)*1e27
9.00000000000000016818799564800000095820042512435586643130912

I'll relax the test tolerance to allow for this...

-- 
Pauli Virtanen




More information about the NumPy-Discussion mailing list