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``.
819
819
820
820
.. note::
821
821
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.
822
822
823
-
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.
823
+
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.
824
824
825
825
**Special cases**
826
826
827
-
For floating-point operands, let ``self`` equal ``x1`` and ``other`` equal ``x2``.
827
+
Let ``self`` equal ``x1`` and ``other`` equal ``x2``.
828
+
829
+
For real-valued floating-point operands,
828
830
829
831
- If ``x1_i`` is not equal to ``1`` and ``x2_i`` is ``NaN``, the result is ``NaN``.
830
832
- 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``.
852
854
- 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``.
853
855
856
+
For complex floating-point operands, special cases should be handled as if the operation is implemented as ``exp(x2*log(x1))``.
857
+
858
+
.. note::
859
+
Conforming implementations are allowed to treat special cases involving complex floating-point operands more carefully than as described in this specification.
860
+
861
+
.. note::
862
+
By convention, the branch cut of the natural logarithm is the negative real axis :math:`(-\infty, 0)`.
863
+
864
+
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`).
865
+
866
+
*Note: branch cuts have provisional status* (see :ref:`branch-cuts`).
867
+
854
868
Parameters
855
869
----------
856
870
self: array
857
-
array instance whose elements correspond to the exponentiation base. Should have a real-valued data type.
871
+
array instance whose elements correspond to the exponentiation base. Should have a numeric data type.
858
872
other: Union[int, float, array]
859
-
other array whose elements correspond to the exponentiation exponent. Must be compatible with ``self`` (see :ref:`broadcasting`). Should have a real-valued data type.
873
+
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``.
1203
1203
1204
1204
.. note::
1205
1205
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.
1206
1206
1207
-
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).
1207
+
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).
1208
1208
1209
1209
**Special cases**
1210
1210
1211
-
For floating-point operands,
1211
+
For real-valued floating-point operands,
1212
1212
1213
1213
- If ``x1_i`` is not equal to ``1`` and ``x2_i`` is ``NaN``, the result is ``NaN``.
1214
1214
- 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``.
1236
1236
- 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``.
1237
1237
1238
+
For complex floating-point operands, special cases should be handled as if the operation is implemented as ``exp(x2*log(x1))``.
1239
+
1240
+
.. note::
1241
+
Conforming implementations are allowed to treat special cases involving complex floating-point operands more carefully than as described in this specification.
1242
+
1243
+
.. note::
1244
+
By convention, the branch cut of the natural logarithm is the negative real axis :math:`(-\infty, 0)`.
1245
+
1246
+
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`).
1247
+
1248
+
*Note: branch cuts have provisional status* (see :ref:`branch-cuts`).
1249
+
1238
1250
Parameters
1239
1251
----------
1240
1252
x1: array
1241
-
first input array whose elements correspond to the exponentiation base. Should have a real-valued data type.
1253
+
first input array whose elements correspond to the exponentiation base. Should have a numeric data type.
1242
1254
x2: array
1243
-
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.
1255
+
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