Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Computing the sign of a complex number #545

Closed
kgryte opened this issue Dec 1, 2022 · 1 comment · Fixed by #556
Closed

Computing the sign of a complex number #545

kgryte opened this issue Dec 1, 2022 · 1 comment · Fixed by #556
Labels
topic: Complex Data Types Complex number data types.
Milestone

Comments

@kgryte
Copy link
Contributor

kgryte commented Dec 1, 2022

Originally discussed in #153 (comment).

In order to add complex support to sign, we need to agree on the definition for complex numbers.

NumPy uses sqrt(z^2)/z while an arguably more common convention is x/|x|.

For paths forward we have 3 options:

  1. Use NumPy's definition.
  2. Use the more common convention used elsewhere (MATLAB, Julia, etc).
  3. Not support complex numbers in sign.

Questions

  • If we choose (2), given NumPy's potential v2 release, would NumPy be willing to introduce this breaking change?

See Also

@kgryte kgryte added the topic: Complex Data Types Complex number data types. label Dec 1, 2022
@kgryte kgryte added this to the v2022 milestone Dec 1, 2022
@rgommers
Copy link
Member

rgommers commented Dec 2, 2022

As discussed in a couple of places, the z/|z| definition seems clearly better and preferred, also for numpy. Not sure of a timeline for introducing that (breaking changes are always tricky), but I think in this case it's not like they're two equal alternatives. In the standard I think we should go with z/|z|; numpy may not be compliant on that point for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: Complex Data Types Complex number data types.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants