numbers (version 0.7-5)

div: Integer Division

Description

Integer division.

Usage

div(n, m)

Arguments

n

numeric vector (preferably of integers)

m

integer vector (positive, zero, or negative)

Value

A numeric (integer) value or vector/matrix.

Details

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

See Also

mod, rem

Examples

Run this code
# NOT RUN {
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 DataCamp Workspace