rem: Integer Remainder

View source: R/modular.R

remR Documentation

Integer Remainder

Description

Integer remainder function.

Usage

rem(n, m)

Arguments

n

numeric vector (preferably of integers)

m

must be a scalar integer (positive, zero, or negative)

Details

rem(n, m) is the same modulo operator and returns n\,mod\,m. mod(n, 0) is NaN, and the result always has the same sign as n (for n != m and m != 0).

Value

a numeric (integer) value or vector/matrix

See Also

mod, div

Examples

rem(c(-5:5), 5)
rem(c(-5:5), -5)
rem(0, 1)         #=> 0
rem(1, 1)         #=> 0  (always for n == m)
rem(1, 0)         #   NA  (should be NaN)
rem(0, 0)         #=> NaN

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