[Numpy-discussion] Infinity as nan as real part

Stéfan van der Walt stefan at sun.ac.za
Wed Jun 25 08:42:08 EDT 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?

Regards
Stéfan



More information about the NumPy-Discussion mailing list