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 isnan #532

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
16 changes: 14 additions & 2 deletions spec/API_specification/array_api/elementwise_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,15 +858,27 @@ def isnan(x: array, /) -> array:
"""
Tests each element ``x_i`` of the input array ``x`` to determine whether the element is ``NaN``.

**Special Cases**

For real-valued floating-point operands,

- If ``x_i`` is ``NaN``, 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`` or ``b`` is ``NaN``, 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 ``NaN`` and ``False`` otherwise. The returned array should have a data type of ``bool``.
an array containing test results. The returned array should have a data type of ``bool``.
"""

def less(x1: array, x2: array, /) -> array:
Expand Down