Skip to content

Add complex number support to isinf - #530

Merged
rgommers merged 1 commit into
mainfrom
cmplx-isinf
Dec 5, 2022
Merged

Add complex number support to isinf#530
rgommers merged 1 commit into
mainfrom
cmplx-isinf

Conversation

@kgryte

Copy link
Copy Markdown
Contributor

This PR

  • adds complex number support to isinf by documenting special cases. Namely, as long as either a real or imaginary component is positive or negative infinity, the result should be True, including if the other component is NaN. This follows C (one infinity model), Python, Julia, and NumPy.
  • updates the input and output array data types to be any numeric data type, not just real-valued data types.

Reference

>>>z
(inf+nanj)
>>>cmath.isinf(z)
True
>>>importnumpyasnp>>>z
(inf+nanj)
>>>np.isinf(np.array([z]))
array([ True])
julia> z
Inf+NaN*im
julia>isinf(z)
true

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

@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. This seems consistent with existing practice, and I don't think there were any remaining concerns with that behavior. In it goes, thanks @kgryte

@rgommers
rgommers merged commit f81cc32 into mainDec 5, 2022
@rgommers
rgommers deleted the cmplx-isinf branch December 5, 2022 16:46
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.

2 participants

@kgryte@rgommers