powered by
Integer division.
div(n, m)
A numeric (integer) value or vector/matrix.
numeric vector (preferably of integers)
integer vector (positive, zero, or negative)
div(n, m) is integer division, that is discards the fractional part, with the same effect as n %/% m. It can be defined as floor(n/m).
n %/% m
floor(n/m)
mod, rem
mod
rem
div(c(-5:5), 5) div(c(-5:5), -5) div(c(1, -1), 0) #=> Inf -Inf div(0,c(0, 1)) #=> NaN 0
Run the code above in your browser using DataLab