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 complex number support to abs #546

Merged
merged 1 commit into from
Dec 13, 2022
Merged

Add complex number support to abs #546

merged 1 commit into from
Dec 13, 2022

Conversation

kgryte
Copy link
Contributor

@kgryte kgryte commented Dec 5, 2022

This PR

  • adds complex number support to abs by documenting special cases. Special cases follow special cases for C99 hypot.
  • updates the input and output array data types to be any numeric data type, not just real-valued data types.
  • includes a TODO to update the specification once hypot is added to the specification. Ideally, implementations would implement the complex absolute value in terms of hypot in order to avoid undue overflow/underflow during intermediate stages of computation. For now, the specification includes a note instructing implementations to avoid such overflow/underflow.
  • requires that the return data type always be a real-valued data type.

@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 5, 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

For complex floating-point operands, conforming implementations should take care to avoid undue overflow or underflow during intermediate stages of computation.

..
TODO: once ``hypot`` is added to the specification, remove the special cases for complex floating-point operands and the note concerning guarding against undue overflow/underflow, and state that special cases must be handled as if implemented as ``hypot(real(x), imag(x))``.
Copy link
Member

Choose a reason for hiding this comment

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

Checked in the rendered html that this isn't visible, so should be fine to leave that in here.

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.

2 participants