| [ Web Proxy ] |
| Viewing: https://numpy.org/doc/stable/reference/generated/../generated/../generated/numpy.frexp.html | [Back] [Original] |
Decompose the elements of x into mantissa and twos exponent.
Returns (mantissa, exponent), where x = mantissa * 2**exponent.
The mantissa lies in the open interval(-1, 1), while the twos
exponent is a signed integer.
Array of numbers to be decomposed.
Output array for the mantissa. Must have the same shape as x.
Output array for the exponent. Must have the same shape as x.
A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.
This condition is broadcast over the input. At locations where the
condition is True, the out array will be set to the ufunc result.
Elsewhere, the out array will retain its original value.
Note that if an uninitialized out array is created via the default
out=None, locations within it where the condition is False will
remain uninitialized.
For other keyword-only arguments, see the ufunc docs.
Floating values between -1 and 1. This is a scalar if x is a scalar.
Integer exponents of 2. This is a scalar if x is a scalar.
Notes
Complex dtypes are not supported, they will raise a TypeError.
Examples
>>> import numpy as np
>>> x = np.arange(9)
>>> y1, y2 = np.frexp(x)
>>> y1
array([ 0. , 0.5 , 0.5 , 0.75 , 0.5 , 0.625, 0.75 , 0.875,
0.5 ])
>>> y2
array([0, 1, 2, 2, 3, 3, 3, 3, 4], dtype=int32)
>>> y1 * 2**y2
array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.])
| Web Proxy Viewer | New URL | Original Page |