frexp#
- ivy.frexp(x, /, *, out=None)[source]#
Decompose the elements of x into mantissa and twos exponent.
- Parameters:
- Return type:
- Returns:
ret – A tuple of two arrays, the mantissa and the twos exponent.
Examples
>>> x = ivy.array([1, 2, 3]) >>> ivy.frexp(x) (ivy.array([0.5, 0.5, 0.75]), ivy.array([1, 2, 2]))
- Array.frexp(self, /, *, out=None)[source]#
ivy.Array instance method variant of ivy.frexp. This method simply wraps the function, and so the docstring for ivy.frexp also applies to this method with minimal changes.
- Parameters:
self (
Array
) – Input array.out (
Optional
[Tuple
[Array
,Array
]], default:None
) – Alternate output array in which to place the result. The default is None.
- Return type:
Array
- Returns:
ret – The next representable values of x1 in the direction of x2.
Examples
>>> x = ivy.array([1.0, 2.0, 3.0]) >>> x.frexp() ivy.array([[0.5, 0.5, 0.75], [1, 2, 2]])
- Container.frexp(self, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.frexp. This method simply wraps the function, and so the docstring for ivy.frexp also applies to this method with minimal changes.
- Parameters:
self (
Container
) – The container whose arrays should be split into mantissa and exponent.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – container including the mantissa and exponent of x.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([1, 2, 3]), b=ivy.array([1, 5, 10])) >>> x.frexp() {a: (ivy.array([0.5, 0.5, 0.75]), ivy.array([1, 1, 2])), b: (ivy.array([0.5, 0.625, 0.625]), ivy.array([1, 3, 4]))
}