NumPy modf separates fractional and integral components without floor rounding
Separating a number into components requires a rule for negative values as well as positive ones. NumPy modf returns a fractional component and an integral component, in that order. Academia Master Trader presents this English lesson for readers in Brazil, using constructed values to explain output order, signs and reconstruction.
Fractional output comes first
After import numpy as np, define values = np.array([3.75,-3.75,0.25,-0.25,4.]). The assignment fraction, integral = np.modf(values) produces two arrays.
The fractional output is [0.75,-0.75,0.25,-0.25,0.]. The integral output is [3.,-3.,0.,-0.,4.].
The order matters. Assigning the first output to a variable called integral would not change what the function returns; it would only give that component a misleading name.
Each output follows the shape and position arrangement of the input. Corresponding entries describe two components of the same original number.

Negative components retain their direction
For minus 3.75, the integral component is minus three and the fractional component is minus 0.75. Together they add back to minus 3.75.
The integral component is taken towards zero, not towards negative infinity. A floor-based decomposition would use minus four with a positive fractional remainder instead, which is a different convention.
For minus 0.25, the fractional component is minus 0.25 and the integral component is negative zero in the floating-point output. Its numeric magnitude is zero, while its stored sign follows the negative input.
This convention makes the signed fractional component easy to interpret alongside its matching integral component. It is not a rule that forces every fractional remainder into a nonnegative interval.
Integral does not mean integer storage
The integral output contains floating-point values in these examples. The term integral describes the component's mathematical value, not a promise that its array has an integer dtype.
Integer inputs also produce floating-point outputs. For example, np.modf([2,5]) returns fractional values [0.,0.] and integral values [2.,5.].
Do not assume that selecting the second output performs a dtype conversion to integers. If another operation requires an integer array, that is a separate decision with its own numeric limits.
Components can be recombined by position
For the constructed values shown here, fraction + integral reconstructs [3.75,-3.75,0.25,-0.25,4.].
This addition uses matching positions. Sorting one output independently would break that relationship even though both arrays still contain valid numeric values.
The function does not round values to a chosen number of decimal places, format a price or split a text string at a decimal point. It operates on numeric values already supplied to NumPy.
Continue learning with Academia Master Trader at academiamastertrader.com.br and in Aprenda. Keep the fractional-first order and the negative-value convention explicit when explaining a numeric decomposition.