[Numpy-discussion] Ticket #1113, change title?
Pauli Virtanen
pav at iki.fi
Sat May 23 14:33:37 EDT 2009
Sat, 23 May 2009 09:28:08 -0400, David Warde-Farley wrote:
> On 23-May-09, at 8:54 AM, David Cournapeau wrote:
>
>> I have not looked at the code, but if the precision is indeed single
>> precision, a tolerance of 1e-15 may not make much sense (single
>> precision has 7 significant digits in normal representation)
Yes, it should be `max(5*eps, 1e-15)`, and not 1e-15. It just happens
that on x86 the code computes the correct value down to machine precision
for complex64. Actually, I'm a bit perplexed about why this doesn't
upcast:
>>> p = np.complex128(9.999999999333333333e-6 + 1.000000000066666666e-5j)
>>> np.arctanh(np.array([1e-5 + 1e-5j], dtype=np.complex64))/p
array([ 1.+0.j], dtype=complex64)
> Yes, I was wondering about that too, though notably the tests pass on
> x86, and in fact the result on ppc was nowhere near 0 when I checked it.
What do you mean by "nowhere near"? What does the following output for
you:
>>> np.arctanh(np.array([1e-5 + 1e-5j], np.complex64))
array([ 9.99999975e-06 +9.99999975e-06j], dtype=complex64)
--
Pauli Virtanen
More information about the NumPy-Discussion
mailing list