numpy.log2

numpy.log2(x, y=None)

Return the base 2 logarithm.

Parameters:

x : array_like

Input array.

y : array_like

Optional output array with the same shape as x.

Returns:

y : ndarray

The logarithm to the base 2 of x elementwise. NaNs are returned where x is negative.

See also

log, log1p, log10

Examples

>>> np.log2([-1,2,4])
array([ NaN,   1.,   2.])

Previous topic

numpy.log10

Next topic

numpy.log1p

This Page

Quick search