[Numpy-discussion] Infinity as nan as real part

Stéfan van der Walt stefan@sun.ac...
Wed Jun 25 07:42:08 CDT 2008

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?


More information about the Numpy-discussion mailing list