Skip to content

Commit 5f2bb2e

Browse files
committed
Clarify that clip() behavior is undefined when min or max is outside the bounds of x
As discussed in today's consortium meeting. See the discussion at numpy/numpy#24976.
1 parent 25e7177 commit 5f2bb2e

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/array_api_stubs/_2023_12/elementwise_functions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,7 @@ def clip(
805805
806806
- If both ``min`` and ``max`` are ``None``, the elements of the returned array must equal the respective elements in ``x``.
807807
- If a broadcasted element in ``min`` is greater than a corresponding broadcasted element in ``max``, behavior is unspecified and thus implementation-dependent.
808+
- If ``x`` has an integral data type and a broadcasted element in ``min`` or ``max`` is outside the bounds of the data type of ``x``, the behavior is unspecified and thus implementation-dependent.
808809
- If ``x`` and either ``min`` or ``max`` have different data type kinds (e.g., integer versus floating-point), behavior is unspecified and thus implementation-dependent.
809810
810811
.. versionadded:: 2023.12

src/array_api_stubs/_draft/elementwise_functions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,7 @@ def clip(
806806
807807
- If both ``min`` and ``max`` are ``None``, the elements of the returned array must equal the respective elements in ``x``.
808808
- If a broadcasted element in ``min`` is greater than a corresponding broadcasted element in ``max``, behavior is unspecified and thus implementation-dependent.
809+
- If ``x`` has an integral data type and a broadcasted element in ``min`` or ``max`` is outside the bounds of the data type of ``x``, the behavior is unspecified and thus implementation-dependent.
809810
- If ``x`` and either ``min`` or ``max`` have different data type kinds (e.g., integer versus floating-point), behavior is unspecified and thus implementation-dependent.
810811
811812
.. versionadded:: 2023.12

0 commit comments

Comments
 (0)