modf#
- ivy.modf(x, /, *, out=None)[source]#
Decompose the elements of x into fractional and integral parts.
- Parameters:
- Return type:
- Returns:
ret – A tuple of two arrays, the fractional and integral parts.
Examples
>>> x = ivy.array([1.5, 2.7, 3.9]) >>> ivy.modf(x) (ivy.array([0.5, 0.7, 0.9]), ivy.array([1, 2, 3]))
- Array.modf(self, /, *, out=None)[source]#
ivy.Array instance method variant of ivy.modf. This method simply wraps the function, and so the docstring for ivy.modf also applies to this method with minimal changes.
- Parameters:
self (
Array
) – Input array.out (
Optional
[Tuple
[Array
,Array
]], default:None
) – Alternate output arrays in which to place the result. The default is None.
- Return type:
Tuple
[Array
,Array
]- Returns:
ret – The fractional and integral parts of the input array.
Examples
>>> x = ivy.array([1.5, 2.7, 3.9]) >>> x.modf() (ivy.array([0.5, 0.7, 0.9]), ivy.array([1, 2, 3]))
- Container.modf(self, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.modf. This method simply wraps the function, and so the docstring for ivy.modf also applies to this method with minimal changes.
- Parameters:
self (
Container
) – The container whose arrays should be split into the fractional and integral parts.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – container including the fractional and integral parts of x.
Examples
With one
ivy.Container
input: >>> x = ivy.Container(a=ivy.array([1.2, 2.7, 3.9]), >>> b = ivy.array([-1.5, 5.3, -10.7])) >>> x.modf() {a: (ivy.array([0.2, 0.7, 0.9]), ivy.array([1.0, 2.0, 3.0])), b: (ivy.array([-0.5, 0.3, -0.7]), ivy.array([-1.0, 5.0, -10.0]))
}