spire.math
This implements sgn(z), which (except for z=0) observes:
sgn(z) = z / abs(z) = abs(z) / z
This returns the sign of real if it is not 0, otherwise it returns the sign of imag.
real
imag