remainder

remainder(x1, x2, out=None, **kwargs)

Return element-wise remainder of division.

Parameters:
x1 : ndarray or scalar

Dividend array.

x2 : ndarray or scalar

Divisor array.

out : ndarray

A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.

Returns:
out : ndarray or scalar

This is a scalar if both x1 and x2 are scalars.

Examples

>>> np.remainder(np.arange(7), 5)
array([0., 1., 2., 3., 4., 0., 1.])