div: Integer Division

View source: R/modular.R

divR Documentation

Integer Division

Description

Integer division.

Usage

div(n, m)

Arguments

n

numeric vector (preferably of integers)

m

integer vector (positive, zero, or negative)

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

Value

A numeric (integer) value or vector/matrix.

See Also

mod, rem

Examples

div(c(-5:5), 5)
div(c(-5:5), -5)
div(c(1, -1), 0)  #=> Inf -Inf
div(0,c(0, 1))    #=> NaN  0      

numbers documentation built on Nov. 23, 2022, 9:06 a.m.