Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add complex number support to equal #528

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 5 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Add explicit cases for +0 and -0
  • Loading branch information
kgryte committed Dec 1, 2022
commit 0314be462604c2023c09a45fba07508108727be5
2 changes: 2 additions & 0 deletions spec/API_specification/array_api/array_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ def __eq__(self: array, other: Union[int, float, bool, array], /) -> array:
- If ``x1_i`` is ``NaN`` or ``x2_i`` is ``NaN``, the result is ``False``.
- If ``x1_i`` is ``+infinity`` and ``x2_i`` is ``+infinity``, the result is ``True``.
- If ``x1_i`` is ``-infinity`` and ``x2_i`` is ``-infinity``, the result is ``True``.
- If ``x1_i`` is ``-0`` and ``x2_i`` is either ``+0`` or ``-0``, the result is ``True``.
- If ``x1_i`` is ``+0`` and ``x2_i`` is either ``+0`` or ``-0``, the result is ``True``.
- If ``x1_i`` is a finite number, ``x2_i`` is a finite number, and ``x1_i`` equals ``x2_i``, the result is ``True``.
- In the remaining cases, the result is ``False``.
Copy link
Member

Choose a reason for hiding this comment

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

This is 100% duplicate content, please refer to equal instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we chose to duplicate content, where applicable, early on during spec writing, so this is the case for all relevant APIs. This should be fine to do as a single pass for all applicable array object APIs.

Copy link
Member

Choose a reason for hiding this comment

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

This strategy creates a bunch of extra work for ourselves for no real gain, so not ideal - but I'll ignore it in the open PRs. I'll go ahead and merge this.


Expand Down
2 changes: 2 additions & 0 deletions spec/API_specification/array_api/elementwise_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,8 @@ def equal(x1: array, x2: array, /) -> array:
- If ``x1_i`` is ``NaN`` or ``x2_i`` is ``NaN``, the result is ``False``.
- If ``x1_i`` is ``+infinity`` and ``x2_i`` is ``+infinity``, the result is ``True``.
- If ``x1_i`` is ``-infinity`` and ``x2_i`` is ``-infinity``, the result is ``True``.
- If ``x1_i`` is ``-0`` and ``x2_i`` is either ``+0`` or ``-0``, the result is ``True``.
- If ``x1_i`` is ``+0`` and ``x2_i`` is either ``+0`` or ``-0``, the result is ``True``.
- If ``x1_i`` is a finite number, ``x2_i`` is a finite number, and ``x1_i`` equals ``x2_i``, the result is ``True``.
- In the remaining cases, the result is ``False``.

Expand Down