__pow__¶
- array.__pow__(other: 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), whereother_iis the corresponding element of the arrayother.Note
If both
selfandotherhave integer data types, the result of__pow__whenother_iis negative (i.e., less than zero) is unspecified and thus implementation-dependent.If
selfhas an integer data type andotherhas 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
selfequalx1andotherequalx2.If
x1_iis not equal to1andx2_iisNaN, the result isNaN.If
x2_iis+0, the result is1, even ifx1_iisNaN.If
x2_iis-0, the result is1, even ifx1_iisNaN.If
x1_iisNaNandx2_iis not equal to0, the result isNaN.If
abs(x1_i)is greater than1andx2_iis+infinity, the result is+infinity.If
abs(x1_i)is greater than1andx2_iis-infinity, the result is+0.If
abs(x1_i)is1andx2_iis+infinity, the result is1.If
abs(x1_i)is1andx2_iis-infinity, the result is1.If
x1_iis1andx2_iis notNaN, the result is1.If
abs(x1_i)is less than1andx2_iis+infinity, the result is+0.If
abs(x1_i)is less than1andx2_iis-infinity, the result is+infinity.If
x1_iis+infinityandx2_iis greater than0, the result is+infinity.If
x1_iis+infinityandx2_iis less than0, the result is+0.If
x1_iis-infinity,x2_iis greater than0, andx2_iis an odd integer value, the result is-infinity.If
x1_iis-infinity,x2_iis greater than0, andx2_iis not an odd integer value, the result is+infinity.If
x1_iis-infinity,x2_iis less than0, andx2_iis an odd integer value, the result is-0.If
x1_iis-infinity,x2_iis less than0, andx2_iis not an odd integer value, the result is+0.If
x1_iis+0andx2_iis greater than0, the result is+0.If
x1_iis+0andx2_iis less than0, the result is+infinity.If
x1_iis-0,x2_iis greater than0, andx2_iis an odd integer value, the result is-0.If
x1_iis-0,x2_iis greater than0, andx2_iis not an odd integer value, the result is+0.If
x1_iis-0,x2_iis less than0, andx2_iis an odd integer value, the result is-infinity.If
x1_iis-0,x2_iis less than0, andx2_iis not an odd integer value, the result is+infinity.If
x1_iis less than0,x1_iis a finite number,x2_iis a finite number, andx2_iis not an integer value, the result isNaN.
- 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().