[Numpy-discussion] Corner case complex log error.

Robert Kern robert.kern at gmail.com
Tue Jul 22 16:43:03 EDT 2008


On Tue, Jul 22, 2008 at 15:21, Pauli Virtanen <pav at iki.fi> wrote:
> Tue, 22 Jul 2008 15:13:09 -0500, Robert Kern wrote:
>
>> On Tue, Jul 22, 2008 at 14:57, Pauli Virtanen <pav at iki.fi> wrote:
>>> Tue, 22 Jul 2008 00:34:46 -0600, Charles R Harris wrote:
>>>>
>>>> FAIL: test_umath.TestC99.test_clog(<ufunc 'log'>, (-0.0, -0.0), (-inf,
>>>> -0.0), 'divide')
>>>> AssertionError: ('(-inf, 3.1415926535897931)', '(-inf, 0.0)')
>>>
>>> The interesting thing is that there is no test like this in
>>> test_umath.py. The closest thing is the second test in test_clog, which
>>> is (+0., 0.), (-inf, 0.). Does this vanish if you comment it out?
>>
>> I think it's a weirdness in the way that Python can handle literals in
>> the same statement.
>
> If so, it seems like a platform-dependent quirk:
>
> Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42)
> [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
>
>>>> (-0.0, 0.0)
> (-0.0, 0.0)
>
> Anyway, I marked the probable culprit as skipped for now.

We can define negzero=-0.0 at the top of the file and always use that.

-- 
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