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

Add support for complex number division #554

Merged
merged 2 commits into from Dec 14, 2022
Merged

Add support for complex number division #554

merged 2 commits into from Dec 14, 2022

Conversation

kgryte
Copy link
Contributor

@kgryte kgryte commented Dec 5, 2022

This PR

  • adds support for complex number division. For finite components, complex number division is well-defined and can be readily computed according to the textbook formula for complex number division. However, for complex numbers having infinite or NaN components, results may diverge depending on how one chooses to model complex infinities. In C99 with its one-infinity model, a complex value is infinite, even if the other component is NaN. In order to maintain a single point at infinity, C99 suspends the normal rules of arithmetic floating-point operations and requires branching logic within implementations in order to accurately handle special cases. Such branching logic is undesirable when performance is paramount (e.g., in certain accelerator libraries), and, thus, special cases involving NaNs and infinities is specified as implementation-dependent.
  • Specifies that, in general, the special cases described for real-valued floating-point operands apply to the component operations separately. Meaning, operations involving real-valued components (i.e., a, b, c, d) must abide by real-valued floating-point special cases.
  • updates the input and output array data types to be any numeric data type, not just real-valued data types.

@kgryte kgryte added API change Changes to existing functions or objects in the API. topic: Complex Data Types Complex number data types. labels Dec 5, 2022
@kgryte kgryte added this to the v2022 milestone Dec 12, 2022
Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @kgryte

@rgommers rgommers merged commit 31b3df8 into main Dec 14, 2022
@rgommers rgommers deleted the cmplx-divide branch December 14, 2022 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API change Changes to existing functions or objects in the API. topic: Complex Data Types Complex number data types.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants