SciPy

numpy.floor_divide

numpy.floor_divide(x1, x2[, out]) = <ufunc 'floor_divide'>

Return the largest integer smaller or equal to the division of the inputs. It is equivalent to the Python // operator and pairs with the Python % (remainder), function so that b = a % b + b * (a // b) up to roundoff.

Parameters:

x1 : array_like

Numerator.

x2 : array_like

Denominator.

Returns:

y : ndarray

y = floor(x1/x2)

See also

remainder
Remainder complementary to floor_divide.
divide
Standard division.
floor
Round a number to the nearest integer toward minus infinity.
ceil
Round a number to the nearest integer toward infinity.

Examples

>>> np.floor_divide(7,3)
2
>>> np.floor_divide([1., 2., 3., 4.], 2.5)
array([ 0.,  0.,  1.,  1.])

Previous topic

numpy.true_divide

Next topic

numpy.fmod