jax.numpy.modf — JAX documentation (original) (raw)

jax.numpy.modf#

jax.numpy.modf(x, /, out=None)[source]#

Return element-wise fractional and integral parts of the input array.

JAX implementation of numpy.modf.

Parameters:

Returns:

An array containing the fractional and integral parts of the elements of x, promoting dtypes inexact.

Return type:

tuple[Array, Array]

See also

Examples

jnp.modf(4.8) (Array(0.8000002, dtype=float32, weak_type=True), Array(4., dtype=float32, weak_type=True)) x = jnp.array([-3.4, -5.7, 0.6, 1.5, 2.3]) jnp.modf(x) (Array([-0.4000001 , -0.6999998 , 0.6 , 0.5 , 0.29999995], dtype=float32), Array([-3., -5., 0., 1., 2.], dtype=float32))