Skip to content

Commit 4636659

Browse files
committed
Add note that cross-kind comparisons are undefined
Fixes data-apis#819.
1 parent 25e7177 commit 4636659

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

src/array_api_stubs/_draft/array_object.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,9 @@ def __eq__(self: array, other: Union[int, float, bool, array], /) -> array:
513513
514514
.. note::
515515
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.equal`.
516+
517+
.. note::
518+
Comparisons of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
516519
"""
517520

518521
def __float__(self: array, /) -> float:
@@ -599,6 +602,9 @@ def __ge__(self: array, other: Union[int, float, array], /) -> array:
599602
600603
.. note::
601604
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.greater_equal`.
605+
606+
.. note::
607+
Comparisons of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
602608
"""
603609

604610
def __getitem__(
@@ -651,6 +657,9 @@ def __gt__(self: array, other: Union[int, float, array], /) -> array:
651657
652658
.. note::
653659
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.greater`.
660+
661+
.. note::
662+
Comparisons of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
654663
"""
655664

656665
def __index__(self: array, /) -> int:
@@ -748,6 +757,9 @@ def __invert__(self: array, /) -> array:
748757
749758
.. note::
750759
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.bitwise_invert`.
760+
761+
.. note::
762+
Comparisons of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
751763
"""
752764

753765
def __le__(self: array, other: Union[int, float, array], /) -> array:
@@ -772,6 +784,9 @@ def __le__(self: array, other: Union[int, float, array], /) -> array:
772784
773785
.. note::
774786
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.less_equal`.
787+
788+
.. note::
789+
Comparisons of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
775790
"""
776791

777792
def __lshift__(self: array, other: Union[int, array], /) -> array:
@@ -943,6 +958,9 @@ def __ne__(self: array, other: Union[int, float, bool, array], /) -> array:
943958
.. note::
944959
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.not_equal`.
945960
961+
.. note::
962+
Comparisons of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
963+
946964
.. versionchanged:: 2022.12
947965
Added complex data type support.
948966
"""

src/array_api_stubs/_draft/elementwise_functions.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,9 @@ def equal(x1: array, x2: array, /) -> array:
11181118
.. note::
11191119
For discussion of complex number equality, see :ref:`complex-numbers`.
11201120
1121+
.. note::
1122+
Comparisons of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
1123+
11211124
.. versionchanged:: 2022.12
11221125
Added complex data type support.
11231126
"""
@@ -1347,6 +1350,10 @@ def greater(x1: array, x2: array, /) -> array:
13471350
-------
13481351
out: array
13491352
an array containing the element-wise results. The returned array must have a data type of ``bool``.
1353+
1354+
.. note::
1355+
Comparisons of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
1356+
13501357
"""
13511358

13521359

@@ -1368,6 +1375,9 @@ def greater_equal(x1: array, x2: array, /) -> array:
13681375
-------
13691376
out: array
13701377
an array containing the element-wise results. The returned array must have a data type of ``bool``.
1378+
1379+
.. note::
1380+
Comparisons of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
13711381
"""
13721382

13731383

@@ -1563,6 +1573,9 @@ def less(x1: array, x2: array, /) -> array:
15631573
-------
15641574
out: array
15651575
an array containing the element-wise results. The returned array must have a data type of ``bool``.
1576+
1577+
.. note::
1578+
Comparisons of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
15661579
"""
15671580

15681581

@@ -1584,6 +1597,9 @@ def less_equal(x1: array, x2: array, /) -> array:
15841597
-------
15851598
out: array
15861599
an array containing the element-wise results. The returned array must have a data type of ``bool``.
1600+
1601+
.. note::
1602+
Comparisons of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
15871603
"""
15881604

15891605

@@ -2134,6 +2150,9 @@ def not_equal(x1: array, x2: array, /) -> array:
21342150
.. note::
21352151
For discussion of complex number equality, see :ref:`complex-numbers`.
21362152
2153+
.. note::
2154+
Comparisons of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
2155+
21372156
.. versionchanged:: 2022.12
21382157
Added complex data type support.
21392158
"""

0 commit comments

Comments
 (0)