Skip to content

Commit 6d205d7

Browse files
asmeurerkgryte
andauthored
docs: add note that cross-kind comparisons are undefined
PR-URL: #822 Closes: #819 Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Athan Reines <[email protected]>
1 parent c28d3c5 commit 6d205d7

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

src/array_api_stubs/_draft/array_object.py

+18
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+
Comparison 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+
Comparison of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
602608
"""
603609

604610
def __getitem__(
@@ -657,6 +663,9 @@ def __gt__(self: array, other: Union[int, float, array], /) -> array:
657663
658664
.. note::
659665
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.greater`.
666+
667+
.. note::
668+
Comparison of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
660669
"""
661670

662671
def __index__(self: array, /) -> int:
@@ -778,6 +787,9 @@ def __le__(self: array, other: Union[int, float, array], /) -> array:
778787
779788
.. note::
780789
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.less_equal`.
790+
791+
.. note::
792+
Comparison of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
781793
"""
782794

783795
def __lshift__(self: array, other: Union[int, array], /) -> array:
@@ -823,6 +835,9 @@ def __lt__(self: array, other: Union[int, float, array], /) -> array:
823835
824836
.. note::
825837
Element-wise results must equal the results returned by the equivalent element-wise function :func:`~array_api.less`.
838+
839+
.. note::
840+
Comparison of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
826841
"""
827842

828843
def __matmul__(self: array, other: array, /) -> array:
@@ -949,6 +964,9 @@ def __ne__(self: array, other: Union[int, float, bool, array], /) -> array:
949964
.. note::
950965
Element-wise results, including special cases, must equal the results returned by the equivalent element-wise function :func:`~array_api.not_equal`.
951966
967+
.. note::
968+
Comparison of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
969+
952970
.. versionchanged:: 2022.12
953971
Added complex data type support.
954972
"""

src/array_api_stubs/_draft/elementwise_functions.py

+19
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,9 @@ def equal(x1: array, x2: array, /) -> array:
11251125
.. note::
11261126
For discussion of complex number equality, see :ref:`complex-numbers`.
11271127
1128+
.. note::
1129+
Comparison of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
1130+
11281131
.. versionchanged:: 2022.12
11291132
Added complex data type support.
11301133
"""
@@ -1354,6 +1357,10 @@ def greater(x1: array, x2: array, /) -> array:
13541357
-------
13551358
out: array
13561359
an array containing the element-wise results. The returned array must have a data type of ``bool``.
1360+
1361+
.. note::
1362+
Comparison of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
1363+
13571364
"""
13581365

13591366

@@ -1375,6 +1382,9 @@ def greater_equal(x1: array, x2: array, /) -> array:
13751382
-------
13761383
out: array
13771384
an array containing the element-wise results. The returned array must have a data type of ``bool``.
1385+
1386+
.. note::
1387+
Comparison of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
13781388
"""
13791389

13801390

@@ -1570,6 +1580,9 @@ def less(x1: array, x2: array, /) -> array:
15701580
-------
15711581
out: array
15721582
an array containing the element-wise results. The returned array must have a data type of ``bool``.
1583+
1584+
.. note::
1585+
Comparison of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
15731586
"""
15741587

15751588

@@ -1591,6 +1604,9 @@ def less_equal(x1: array, x2: array, /) -> array:
15911604
-------
15921605
out: array
15931606
an array containing the element-wise results. The returned array must have a data type of ``bool``.
1607+
1608+
.. note::
1609+
Comparison of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
15941610
"""
15951611

15961612

@@ -2141,6 +2157,9 @@ def not_equal(x1: array, x2: array, /) -> array:
21412157
.. note::
21422158
For discussion of complex number equality, see :ref:`complex-numbers`.
21432159
2160+
.. note::
2161+
Comparison of arrays without a corresponding promotable data type (see :ref:`type-promotion`) is undefined and thus implementation-dependent.
2162+
21442163
.. versionchanged:: 2022.12
21452164
Added complex data type support.
21462165
"""

0 commit comments

Comments
 (0)