[Numpy-discussion] incorrect behavior when complex number with zero imaginary part is multiplied by inf

Mark Bakker markbak at gmail.com
Fri Jan 28 05:49:34 EST 2011


When I multiply a complex number with inf, I get inf + inf*j:

In [17]: inf * (1+1j)
Out[17]: (inf+inf*j)

Even when the imaginary part is really small:

In [18]: inf * (1+1e-100j)
Out[18]: (inf+inf*j)

Yet when the imaginary part is zero (and it really is a real number), the
imaginary part is nan:

In [19]: inf * (1+0j)
Out[19]: (inf+nan*j)

That is not correct. It should really given (inf+0*j).
(I know where it comes from, inf*0 is not defined, but in this case it is,
as 1+0j is really a real number and inf is by definition real as well).

If there is consensus I can file a ticket.

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110128/d5ffab6c/attachment.html>


More information about the NumPy-Discussion mailing list