Python 3.6+cmathterm
cmath.infj
constants
A complex number with a zero real part and an infinite imaginary part, complex(0.0, inf).
Syntax
cmath.infj
Arithmetic with infinities in complex numbers produces NaN unexpectedly: infj * 1j gives (-inf+nanj), not just -inf, because the multiplication also computes the term 0·inf. Check such values with cmath.isinf and isnan before computing with them.
Examples
import cmath
print(cmath.infj, cmath.infj.real) # → infj 0.0
print(cmath.infj * 1j) # → (-inf+nanj)
See also
Open in the full glossarydocs.python.orgReport an inaccuracy