# __pow__¶

array.__pow__(other: Union[int, float, array], /) array

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`.

Note

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.

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.

Special cases

For floating-point operands, let `self` equal `x1` and `other` equal `x2`.

• If `x1_i` is not equal to `1` and `x2_i` is `NaN`, the result is `NaN`.

• If `x2_i` is `+0`, the result is `1`, even if `x1_i` is `NaN`.

• If `x2_i` is `-0`, the result is `1`, even if `x1_i` is `NaN`.

• If `x1_i` is `NaN` and `x2_i` is not equal to `0`, the result is `NaN`.

• If `abs(x1_i)` is greater than `1` and `x2_i` is `+infinity`, the result is `+infinity`.

• If `abs(x1_i)` is greater than `1` and `x2_i` is `-infinity`, the result is `+0`.

• If `abs(x1_i)` is `1` and `x2_i` is `+infinity`, the result is `1`.

• If `abs(x1_i)` is `1` and `x2_i` is `-infinity`, the result is `1`.

• If `x1_i` is `1` and `x2_i` is not `NaN`, the result is `1`.

• If `abs(x1_i)` is less than `1` and `x2_i` is `+infinity`, the result is `+0`.

• If `abs(x1_i)` is less than `1` and `x2_i` is `-infinity`, the result is `+infinity`.

• If `x1_i` is `+infinity` and `x2_i` is greater than `0`, the result is `+infinity`.

• If `x1_i` is `+infinity` and `x2_i` is less than `0`, the result is `+0`.

• If `x1_i` is `-infinity`, `x2_i` is greater than `0`, and `x2_i` is an odd integer value, the result is `-infinity`.

• If `x1_i` is `-infinity`, `x2_i` is greater than `0`, and `x2_i` is not an odd integer value, the result is `+infinity`.

• If `x1_i` is `-infinity`, `x2_i` is less than `0`, and `x2_i` is an odd integer value, the result is `-0`.

• If `x1_i` is `-infinity`, `x2_i` is less than `0`, and `x2_i` is not an odd integer value, the result is `+0`.

• If `x1_i` is `+0` and `x2_i` is greater than `0`, the result is `+0`.

• If `x1_i` is `+0` and `x2_i` is less than `0`, the result is `+infinity`.

• If `x1_i` is `-0`, `x2_i` is greater than `0`, and `x2_i` is an odd integer value, the result is `-0`.

• If `x1_i` is `-0`, `x2_i` is greater than `0`, and `x2_i` is not an odd integer value, the result is `+0`.

• If `x1_i` is `-0`, `x2_i` is less than `0`, and `x2_i` is an odd integer value, the result is `-infinity`.

• If `x1_i` is `-0`, `x2_i` is less than `0`, and `x2_i` is not an odd integer value, the result is `+infinity`.

• 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`.

Parameters
• self (array) – array instance whose elements correspond to the exponentiation base. Should have a numeric data type.

• other (Union[int, float, array]) – other array whose elements correspond to the exponentiation exponent. Must be compatible with `self` (see Broadcasting). Should have a numeric data type.

Returns

out (array) – an array containing the element-wise results. The returned array must have a data type determined by Type Promotion Rules.

Note

Element-wise results must equal the results returned by the equivalent element-wise function `pow()`.