Skip to content

Commit

Permalink
Specify the behavior of clip() when one of the operands is nan
Browse files Browse the repository at this point in the history
  • Loading branch information
asmeurer committed Jun 5, 2024
1 parent 25e7177 commit 2f6b865
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 @@ -808,6 +808,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 2f6b865

Please sign in to comment.