floor_divide(x1, x2, out=None)

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 a = a % b + b * (a // b) up to roundoff.

  • 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.


  • out (ndarray or scalar) – This is a scalar if both x1 and x2 are scalars.

  • .. note:: – This operator now supports automatic type promotion. The resulting type will be determined according to the following rules:

    • If both inputs are of floating number types, the output is the more precise type.

    • If only one of the inputs is floating number type, the result is that type.

    • If both inputs are of integer types (including boolean), the output is the more precise type


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