robpike / ivy

ivy, an APL-like calculator
Other
1.32k stars 103 forks source link

ivy: implement 'sgn' for complex numbers #141

Closed fzipp closed 1 year ago

fzipp commented 1 year ago

The generalization of the signum function for complex numbers is

sgn z = z/|z| if z≠0, and 0 if z=0

See https://en.wikipedia.org/wiki/Sign_function#Complex_signum