numpy.modf

numpy.modf(x[, out1, out2])

Return the fractional and integral part of a number.

The fractional and integral parts are negative if the given number is negative.

Parameters:

x : array_like

Input number.

Returns:

y1 : ndarray

Fractional part of x.

y2 : ndarray

Integral part of x.

Examples

>>> np.modf(2.5)
(0.5, 2.0)
>>> np.modf(-.4)
(-0.40000000000000002, -0.0)

Previous topic

numpy.mod

Next topic

numpy.remainder

This Page

Quick search