Python Tutorial Python Advanced Python References Python Libraries

Python cmath - infj



The Python cmath.infj is used to return a complex number with zero real part and positive infinity imaginary part. It is equivalent to the output of complex(0.0, float('inf')).

Syntax

#New in version 3.6
cmath.infj

Parameters

No parameter is required.

Return Value

Returns a complex number with zero real part and positive infinity imaginary part.

Example:

The example below shows the usage of cmath.infj.

import cmath

#print complex(0.0, float('inf'))
print(cmath.infj)

#print -complex(0.0, float('inf'))
print(-cmath.infj)

The output of the above code will be:

infj
(-0-infj)

❮ Python cMath Module