Skip to content

Add complex number support for pow - #537

Merged
rgommers merged 1 commit into
mainfrom
cmplx-pow
Dec 13, 2022
Merged

Add complex number support for pow#537
rgommers merged 1 commit into
mainfrom
cmplx-pow

Conversation

@kgryte

Copy link
Copy Markdown
Contributor

This PR

  • adds complex number support to pow by documenting special cases. This PR indicates that implementations should handle special cases as if pow is implemented exp(x2*log(x1)), following C99; however, implementations are allowed to handle special cases more carefully. Accordingly, pow inherits a branch cut from log. In general, pow is underspecified, as handling all special cases is difficult given the number of argument permutations.
  • updates the input and output array data types to be any numeric data type, not just real-valued data types.
  • derives special cases from C99

References

@kgrytekgryte added API change Changes to existing functions or objects in the API. topic: Complex Data Types Complex number data types. labels Dec 1, 2022
@kgrytekgryte added this to the v2022 milestone Dec 1, 2022
@seberg

Copy link
Copy Markdown
Contributor

Btw. do you happen to have a clear answer to what the branch-cuts are with respect to returning -0 for the case of 0**something?

@kgryte

Copy link
Copy Markdown
ContributorAuthor

@seberg For the case of 0**something, I believe this should just follow IEEE 754, so long as something is real-valued. If something is a complex number, the branch cut from log would apply and the result would be according to exp.

@rgommersrgommers left a comment

Copy link
Copy Markdown
Member

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 f6c18b5 into mainDec 13, 2022
@rgommers
rgommers deleted the cmplx-pow branch December 13, 2022 21:27
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API changeChanges to existing functions or objects in the API.topic: Complex Data TypesComplex number data types.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@kgryte@seberg@rgommers