robpike / ivy

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

ivy: implement 'sgn' for complex numbers #142

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

fzipp commented 1 year ago

Sorry for the botched pull request #141.

robpike commented 1 year ago

Thanks.