Returns an array containing the quotient and modulus obtained by dividing num by numeric.
Returns an array containing the quotient and modulus obtained by dividing num by numeric.
If q, r = x.divmod(y), then
q = floor(x/y)
x = q*y+r
The table below displays the difference between div, divmod, module and remainder methods is displayed below:
Examples:
11.divmod(3) #=> [3, 2]
11.divmod(-3) #=> [-4, -1]
11.divmod(3.5) #=> [3, 0.5]
(-11).divmod(3.5) #=> [-4, 3.0]
(11.5).divmod(3.5) #=> [3, 1.0]