[Numpy-discussion] Infinity as nan as real part

Charles R Harris charlesr.harris at gmail.com
Wed Jun 25 15:13:35 EDT 2008


On Wed, Jun 25, 2008 at 6:42 AM, Stéfan van der Walt <stefan at sun.ac.za>
wrote:

> Hi all,
>
> Why can't a person construct a complex number with an infinite complex
> part and a zero real part?
>
> 1 + 1j*np.inf == (nan + infj) # because np.inf * 1j == (nan + infj)
>
> There is a workaround:
>
> z = np.array([0], dtype=complex)
> z.imag = np.inf
>
> but that's not very pleasant.
>
> Is this a bug, or intended behaviour?
>

Probably a bug.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080625/bb279829/attachment.html>


More information about the NumPy-Discussion mailing list