This is documentation for an old release of NumPy (version 1.3.). Read this page in the documentation of the latest stable release (version > 1.17).
Return the remainder of division.
This is the NumPy implementation of the C modulo operator %.
Parameters: | x1 : array_like
x2 : array_like
|
---|---|
Returns: | y : array_like
|
See also
Notes
The result of the modulo operation for negative dividend and divisors is bound by conventions. In fmod, the sign of the remainder is the sign of the dividend, and the sign of the divisor has no influence on the results.
Examples
>>> np.fmod([-3, -2, -1, 1, 2, 3], 2)
array([-1, 0, -1, 1, 0, 1])
>>> np.mod([-3, -2, -1, 1, 2, 3], 2)
array([1, 0, 1, 1, 0, 1])