Skip to content

Commit 6e9c487

Browse files
authored
docs: add note concerning signed zeros (#751)
1 parent bc48a1a commit 6e9c487

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

Diff for: src/array_api_stubs/_draft/elementwise_functions.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -1905,9 +1905,6 @@ def maximum(x1: array, x2: array, /) -> array:
19051905
r"""
19061906
Computes the maximum value for each element ``x1_i`` of the input array ``x1`` relative to the respective element ``x2_i`` of the input array ``x2``.
19071907
1908-
.. note::
1909-
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
1910-
19111908
Parameters
19121909
----------
19131910
x1: array
@@ -1923,6 +1920,10 @@ def maximum(x1: array, x2: array, /) -> array:
19231920
Notes
19241921
-----
19251922
1923+
The order of signed zeros is unspecified and thus implementation-defined. When choosing between ``-0`` or ``+0`` as a maximum value, specification-compliant libraries may choose to return either value.
1924+
1925+
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-defined (see :ref:`complex-number-ordering`).
1926+
19261927
**Special Cases**
19271928
19281929
For floating-point operands,
@@ -1935,9 +1936,6 @@ def minimum(x1: array, x2: array, /) -> array:
19351936
r"""
19361937
Computes the minimum value for each element ``x1_i`` of the input array ``x1`` relative to the respective element ``x2_i`` of the input array ``x2``.
19371938
1938-
.. note::
1939-
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
1940-
19411939
Parameters
19421940
----------
19431941
x1: array
@@ -1953,6 +1951,10 @@ def minimum(x1: array, x2: array, /) -> array:
19531951
Notes
19541952
-----
19551953
1954+
The order of signed zeros is unspecified and thus implementation-defined. When choosing between ``-0`` or ``+0`` as a minimum value, specification-compliant libraries may choose to return either value.
1955+
1956+
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-defined (see :ref:`complex-number-ordering`).
1957+
19561958
**Special Cases**
19571959
19581960
For floating-point operands,

Diff for: src/array_api_stubs/_draft/statistical_functions.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,6 @@ def max(
6464
"""
6565
Calculates the maximum value of the input array ``x``.
6666
67-
.. note::
68-
When the number of elements over which to compute the maximum value is zero, the maximum value is implementation-defined. Specification-compliant libraries may choose to raise an error, return a sentinel value (e.g., if ``x`` is a floating-point input array, return ``NaN``), or return the minimum possible value for the input array ``x`` data type (e.g., if ``x`` is a floating-point array, return ``-infinity``).
69-
70-
.. note::
71-
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
72-
7367
Parameters
7468
----------
7569
x: array
@@ -87,6 +81,12 @@ def max(
8781
Notes
8882
-----
8983
84+
When the number of elements over which to compute the maximum value is zero, the maximum value is implementation-defined. Specification-compliant libraries may choose to raise an error, return a sentinel value (e.g., if ``x`` is a floating-point input array, return ``NaN``), or return the minimum possible value for the input array ``x`` data type (e.g., if ``x`` is a floating-point array, return ``-infinity``).
85+
86+
The order of signed zeros is unspecified and thus implementation-defined. When choosing between ``-0`` or ``+0`` as a maximum value, specification-compliant libraries may choose to return either value.
87+
88+
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-defined (see :ref:`complex-number-ordering`).
89+
9090
**Special Cases**
9191
9292
For floating-point operands,
@@ -144,12 +144,6 @@ def min(
144144
"""
145145
Calculates the minimum value of the input array ``x``.
146146
147-
.. note::
148-
When the number of elements over which to compute the minimum value is zero, the minimum value is implementation-defined. Specification-compliant libraries may choose to raise an error, return a sentinel value (e.g., if ``x`` is a floating-point input array, return ``NaN``), or return the maximum possible value for the input array ``x`` data type (e.g., if ``x`` is a floating-point array, return ``+infinity``).
149-
150-
.. note::
151-
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
152-
153147
Parameters
154148
----------
155149
x: array
@@ -167,6 +161,12 @@ def min(
167161
Notes
168162
-----
169163
164+
When the number of elements over which to compute the minimum value is zero, the minimum value is implementation-defined. Specification-compliant libraries may choose to raise an error, return a sentinel value (e.g., if ``x`` is a floating-point input array, return ``NaN``), or return the maximum possible value for the input array ``x`` data type (e.g., if ``x`` is a floating-point array, return ``+infinity``).
165+
166+
The order of signed zeros is unspecified and thus implementation-defined. When choosing between ``-0`` or ``+0`` as a minimum value, specification-compliant libraries may choose to return either value.
167+
168+
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-defined (see :ref:`complex-number-ordering`).
169+
170170
**Special Cases**
171171
172172
For floating-point operands,

0 commit comments

Comments
 (0)