jax.numpy.frexp
Contents
jax.numpy.frexp#
- jax.numpy.frexp(x,/)[source]#
Split floating point values into mantissa and twos exponent.
JAX implementation of
numpy.frexp().- Parameters:
x (ArrayLike) – real-valued array
- Returns:
A tuple
(mantissa,exponent)wheremantissais a floating pointvalue between -1 and 1, andexponentis an integer such thatx==mantissa*2**exponent.- Return type:
See also
jax.numpy.ldexp(): compute the inverse offrexp.
Examples
Split values into mantissa and exponent:
>>>x=jnp.array([1.,2.,3.,4.,5.])>>>m,e=jnp.frexp(x)>>>mArray([0.5 , 0.5 , 0.75 , 0.5 , 0.625], dtype=float32)>>>eArray([1, 2, 2, 3, 3], dtype=int32)
Reconstruct the original array:
>>>m*2**eArray([1., 2., 3., 4., 5.], dtype=float32)
Contents
