[Numpy-discussion] ANN: NumPy 1.2.0

Pauli Virtanen pav at iki.fi
Mon Sep 29 06:44:17 EDT 2008


Mon, 29 Sep 2008 12:33:32 +0200, Matthieu Brucher wrote:

> 2008/9/29 Pauli Virtanen <pav at iki.fi>:
>> Mon, 29 Sep 2008 12:07:53 +0200, Matthieu Brucher wrote:
>>
>>>>>>> np.log(-1 + 0j)
>>>> 3.1415926535897931j
>>>>>>> np.log(-1 - 1e-99j)
>>>> -3.1415926535897931j
>>>>>>> np.log(-1 + 1e-99j)
>>>> 3.1415926535897931j
>>>>
>>>> I'd guess this is typically harmless, but may lead to problems if
>>>> your code relies on the choice of branch at the branch cut.
>>>>
>>>> Could you check if this is really the case? If log seems to work OK,
>>>> then it's a problem with the test and not the functions.
>>>
>>> The result is what you expected.
>>
>> Do you mean that the problem is with the test, or with the branch cut
>> of log?
> 
> I don't know, but the results are :
> 
>>>> np.log(-1 + 0j)
> 3.1415926535897931j
>>>> np.log(-1 - 1e-99j)
> -3.1415926535897931j
>>>> np.log(-1 + 1e-99j)
> 3.1415926535897931j

Ok, then the problem must be that with ICC, numpy's log does not respect 
the negative zero in the imaginary part. On my platform, it does:

>>> import numpy as np
>>> x = 1 + 0j
>>> np.log(-x)
-3.1415926535897931j
>>> np.log(-1 - 0j)
3.1415926535897931j

So probably also this test should be marked as a known failure (for some 
platforms). But this is probably harmless anyway.

-- 
Pauli Virtanen




More information about the NumPy-Discussion mailing list