Skip to content

Add complex number support to isinf #530

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

Merged
merged 1 commit into from
Dec 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions spec/API_specification/array_api/elementwise_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,15 +843,28 @@ def isinf(x: array, /) -> array:
"""
Tests each element ``x_i`` of the input array ``x`` to determine if equal to positive or negative infinity.

**Special Cases**

For real-valued floating-point operands,

- If ``x_i`` is either ``+infinity`` or ``-infinity``, the result is ``True``.
- In the remaining cases, the result is ``False``.

For complex floating-point operands, let ``a = real(x_i)``, ``b = imag(x_i)``, and

- If ``a`` is either ``+infinity`` or ``-infinity`` and ``b`` is any value (including ``NaN``), the result is ``True``.
- If ``a`` is either a finite number or ``NaN`` and ``b`` is either ``+infinity`` or ``-infinity``, the result is ``True``.
- In the remaining cases, the result is ``False``.

Parameters
----------
x: array
input array. Should have a real-valued data type.
input array. Should have a numeric data type.

Returns
-------
out: array
an array containing test results. An element ``out_i`` is ``True`` if ``x_i`` is either positive or negative infinity and ``False`` otherwise. The returned array must have a data type of ``bool``.
an array containing test results. The returned array must have a data type of ``bool``.
"""

def isnan(x: array, /) -> array:
Expand Down