Skip to content

Commit 8b0e405

Browse files
authored
docs: specify the behavior of clip() when one of the operands is NaN
PR-URL: #813 Reviewed-by: Athan Reines <[email protected]> Reviewed-by: Ralf Gommers <[email protected]>
1 parent 45b705d commit 8b0e405

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/array_api_stubs/_2023_12/elementwise_functions.py

+6
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,12 @@ def clip(
807807
- If a broadcasted element in ``min`` is greater than a corresponding broadcasted element in ``max``, behavior is unspecified and thus implementation-dependent.
808808
- 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.
809809
810+
**Special cases**
811+
812+
- If ``x_i`` is ``NaN``, the result is ``NaN``.
813+
- If ``min_i`` is ``NaN``, the result is ``NaN``.
814+
- If ``max_i`` is ``NaN``, the result is ``NaN``.
815+
810816
.. versionadded:: 2023.12
811817
"""
812818

src/array_api_stubs/_draft/elementwise_functions.py

+6
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,12 @@ def clip(
809809
- If a broadcasted element in ``min`` is greater than a corresponding broadcasted element in ``max``, behavior is unspecified and thus implementation-dependent.
810810
- 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.
811811
812+
**Special cases**
813+
814+
- If ``x_i`` is ``NaN``, the result is ``NaN``.
815+
- If ``min_i`` is ``NaN``, the result is ``NaN``.
816+
- If ``max_i`` is ``NaN``, the result is ``NaN``.
817+
812818
.. versionadded:: 2023.12
813819
"""
814820

0 commit comments

Comments
 (0)