Skip to content

Commit 0314be4

Browse files
committed
Add explicit cases for +0 and -0
1 parent 1818ba6 commit 0314be4

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

spec/API_specification/array_api/array_object.py

+2
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@ def __eq__(self: array, other: Union[int, float, bool, array], /) -> array:
340340
- If ``x1_i`` is ``NaN`` or ``x2_i`` is ``NaN``, the result is ``False``.
341341
- If ``x1_i`` is ``+infinity`` and ``x2_i`` is ``+infinity``, the result is ``True``.
342342
- If ``x1_i`` is ``-infinity`` and ``x2_i`` is ``-infinity``, the result is ``True``.
343+
- If ``x1_i`` is ``-0`` and ``x2_i`` is either ``+0`` or ``-0``, the result is ``True``.
344+
- If ``x1_i`` is ``+0`` and ``x2_i`` is either ``+0`` or ``-0``, the result is ``True``.
343345
- If ``x1_i`` is a finite number, ``x2_i`` is a finite number, and ``x1_i`` equals ``x2_i``, the result is ``True``.
344346
- In the remaining cases, the result is ``False``.
345347

spec/API_specification/array_api/elementwise_functions.py

+2
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ def equal(x1: array, x2: array, /) -> array:
585585
- If ``x1_i`` is ``NaN`` or ``x2_i`` is ``NaN``, the result is ``False``.
586586
- If ``x1_i`` is ``+infinity`` and ``x2_i`` is ``+infinity``, the result is ``True``.
587587
- If ``x1_i`` is ``-infinity`` and ``x2_i`` is ``-infinity``, the result is ``True``.
588+
- If ``x1_i`` is ``-0`` and ``x2_i`` is either ``+0`` or ``-0``, the result is ``True``.
589+
- If ``x1_i`` is ``+0`` and ``x2_i`` is either ``+0`` or ``-0``, the result is ``True``.
588590
- If ``x1_i`` is a finite number, ``x2_i`` is a finite number, and ``x1_i`` equals ``x2_i``, the result is ``True``.
589591
- In the remaining cases, the result is ``False``.
590592

0 commit comments

Comments
 (0)