You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calculates an implementation-dependent approximation of exponentiation by raising each element (the base) of an array instance to the power of ``other_i`` (the exponent), where ``other_i`` is the corresponding element of the array ``other``.
914
914
915
915
.. note::
916
916
If both ``self`` and ``other`` have integer data types, the result of ``__pow__`` when `other_i` is negative (i.e., less than zero) is unspecified and thus implementation-dependent.
917
917
918
-
If ``self`` has an integer data type and ``other`` has a real-valued floating-point data type, behavior is implementation-dependent, as type promotion between data type "kinds" (e.g., integer versus floating-point) is unspecified.
918
+
If ``self`` has an integer data type and ``other`` has a floating-point data type, behavior is implementation-dependent, as type promotion between data type "kinds" (e.g., integer versus floating-point) is unspecified.
919
919
920
920
**Special cases**
921
921
922
-
For floating-point operands, let ``self`` equal ``x1`` and ``other`` equal ``x2``.
922
+
Let ``self`` equal ``x1`` and ``other`` equal ``x2``.
923
+
924
+
For real-valued floating-point operands,
923
925
924
926
- If ``x1_i`` is not equal to ``1`` and ``x2_i`` is ``NaN``, the result is ``NaN``.
925
927
- If ``x2_i`` is ``+0``, the result is ``1``, even if ``x1_i`` is ``NaN``.
- If ``x1_i`` is ``-0``, ``x2_i`` is less than ``0``, and ``x2_i`` is not an odd integer value, the result is ``+infinity``.
947
949
- If ``x1_i`` is less than ``0``, ``x1_i`` is a finite number, ``x2_i`` is a finite number, and ``x2_i`` is not an integer value, the result is ``NaN``.
948
950
951
+
For complex floating-point operands, special cases should be handled as if the operation is implemented as ``exp(x2*log(x1))``.
952
+
953
+
.. note::
954
+
Conforming implementations are allowed to treat special cases involving complex floating-point operands more carefully than as described in this specification.
955
+
956
+
.. note::
957
+
By convention, the branch cut of the natural logarithm is the negative real axis :math:`(-\infty, 0)`.
958
+
959
+
The natural logarithm is a continuous function from above the branch cut, taking into account the sign of the imaginary component. As special cases involving complex floating-point operands should be handled according to ``exp(other*log(self))``, exponentiation has the same branch cut for ``self`` as the natural logarithm (see :func:`~array_api.log`).
960
+
961
+
*Note: branch cuts have provisional status* (see :ref:`branch-cuts`).
962
+
949
963
Parameters
950
964
----------
951
965
self: array
952
-
array instance whose elements correspond to the exponentiation base. Should have a real-valued data type.
966
+
array instance whose elements correspond to the exponentiation base. Should have a numeric data type.
953
967
other: Union[int, float, array]
954
-
other array whose elements correspond to the exponentiation exponent. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a real-valued data type.
968
+
other array whose elements correspond to the exponentiation exponent. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a numeric data type.
Calculates an implementation-dependent approximation of exponentiation by raising each element ``x1_i`` (the base) of the input array ``x1`` to the power of ``x2_i`` (the exponent), where ``x2_i`` is the corresponding element of the input array ``x2``.
1556
1556
1557
1557
.. note::
1558
1558
If both ``x1`` and ``x2`` have integer data types, the result of ``pow`` when ``x2_i`` is negative (i.e., less than zero) is unspecified and thus implementation-dependent.
1559
1559
1560
-
If ``x1`` has an integer data type and ``x2`` has a real-valued floating-point data type, behavior is implementation-dependent (type promotion between data type "kinds" (integer versus floating-point) is unspecified).
1560
+
If ``x1`` has an integer data type and ``x2`` has a floating-point data type, behavior is implementation-dependent (type promotion between data type "kinds" (integer versus floating-point) is unspecified).
1561
1561
1562
1562
**Special cases**
1563
1563
1564
-
For floating-point operands,
1564
+
For real-valued floating-point operands,
1565
1565
1566
1566
- If ``x1_i`` is not equal to ``1`` and ``x2_i`` is ``NaN``, the result is ``NaN``.
1567
1567
- If ``x2_i`` is ``+0``, the result is ``1``, even if ``x1_i`` is ``NaN``.
- If ``x1_i`` is ``-0``, ``x2_i`` is less than ``0``, and ``x2_i`` is not an odd integer value, the result is ``+infinity``.
1589
1589
- If ``x1_i`` is less than ``0``, ``x1_i`` is a finite number, ``x2_i`` is a finite number, and ``x2_i`` is not an integer value, the result is ``NaN``.
1590
1590
1591
+
For complex floating-point operands, special cases should be handled as if the operation is implemented as ``exp(x2*log(x1))``.
1592
+
1593
+
.. note::
1594
+
Conforming implementations are allowed to treat special cases involving complex floating-point operands more carefully than as described in this specification.
1595
+
1596
+
.. note::
1597
+
By convention, the branch cut of the natural logarithm is the negative real axis :math:`(-\infty, 0)`.
1598
+
1599
+
The natural logarithm is a continuous function from above the branch cut, taking into account the sign of the imaginary component. As special cases involving complex floating-point operands should be handled according to ``exp(x2*log(x1))``, exponentiation has the same branch cut for ``x1`` as the natural logarithm (see :func:`~array_api.log`).
1600
+
1601
+
*Note: branch cuts have provisional status* (see :ref:`branch-cuts`).
1602
+
1591
1603
Parameters
1592
1604
----------
1593
1605
x1: array
1594
-
first input array whose elements correspond to the exponentiation base. Should have a real-valued data type.
1606
+
first input array whose elements correspond to the exponentiation base. Should have a numeric data type.
1595
1607
x2: array
1596
-
second input array whose elements correspond to the exponentiation exponent. Must be compatible with ``x1`` (see :ref:`broadcasting`). Should have a real-valued data type.
1608
+
second input array whose elements correspond to the exponentiation exponent. Must be compatible with ``x1`` (see :ref:`broadcasting`). Should have a numeric data type.
0 commit comments