Skip to content

Commit

Permalink
docs: specify the behavior of clip() when one of the operands is NaN
Browse files Browse the repository at this point in the history
PR-URL: #813
Reviewed-by: Athan Reines <[email protected]>
Reviewed-by: Ralf Gommers <[email protected]>
  • Loading branch information
asmeurer committed Sep 19, 2024
1 parent 45b705d commit 8b0e405
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/array_api_stubs/_2023_12/elementwise_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,12 @@ def clip(
- If a broadcasted element in ``min`` is greater than a corresponding broadcasted element in ``max``, behavior is unspecified and thus implementation-dependent.
- 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.
**Special cases**
- If ``x_i`` is ``NaN``, the result is ``NaN``.
- If ``min_i`` is ``NaN``, the result is ``NaN``.
- If ``max_i`` is ``NaN``, the result is ``NaN``.
.. versionadded:: 2023.12
"""

Expand Down
6 changes: 6 additions & 0 deletions src/array_api_stubs/_draft/elementwise_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,12 @@ def clip(
- If a broadcasted element in ``min`` is greater than a corresponding broadcasted element in ``max``, behavior is unspecified and thus implementation-dependent.
- 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.
**Special cases**
- If ``x_i`` is ``NaN``, the result is ``NaN``.
- If ``min_i`` is ``NaN``, the result is ``NaN``.
- If ``max_i`` is ``NaN``, the result is ``NaN``.
.. versionadded:: 2023.12
"""

Expand Down

0 comments on commit 8b0e405

Please sign in to comment.