log2¶
- log2(x: array, /) array¶
Calculates an implementation-dependent approximation to the base
2logarithm, having domain[0, +infinity]and codomain[-infinity, +infinity], for each elementx_iof the input arrayx.Special cases
For floating-point operands,
If
x_iisNaN, the result isNaN.If
x_iis less than0, the result isNaN.If
x_iis either+0or-0, the result is-infinity.If
x_iis1, the result is+0.If
x_iis+infinity, the result is+infinity.
- Parameters:
x (array) – input array. Should have a floating-point data type.
- Returns:
out (array) – an array containing the evaluated base
2logarithm for each element inx. The returned array must have a floating-point data type determined by Type Promotion Rules.