cmath.phase(x)
Return the phase of x (also known as the argument of x), as a float. phase(x)
is equivalent to math.atan2(x.imag,
x.real)
. The result lies in the range [-π, π], and the branch cut for this operation lies along the negative real axis, continuous from above. On systems with support for signed zeros (which includes most systems in current use), this means that the sign of the result is the same as the sign of x.imag
, even when x.imag
is zero:
>>> phase(complex(-1.0, 0.0)) 3.141592653589793 >>> phase(complex(-1.0, -0.0)) -3.141592653589793
Please login to continue.