Element-wise remainder. This
differs from base R's %%, use nv_mod()/%% instead.
Arguments
- x, y
(
arrayish)
Two inputs with a common data type. Can be any numeric data type. Scalars are broadcast. An R value takes the other operand's data type when that is in its own or a higher category. Otherwise it settles on its default data type, and the operands meet at their common data type.
Value
(arrayish)
Has the inputs' broadcast shape and common data type.
See also
nv_mod() for the flooring remainder, prim_remainder() for the
underlying primitive.
Examples
x <- nv_array(c(7, 8, 9))
y <- nv_array(c(3, 3, 4))
nv_remainder(x, y)
#> AnvlArray
#> 1
#> 2
#> 1
#> [ CPUf32{3} ]
# different data types are promoted to their common one
nv_remainder(nv_scalar(7, "f32"), nv_scalar(3, "f64"))
#> AnvlArray
#> 1
#> [ CPUf64{} ]
# a scalar is broadcast and an R integer is converted to a float
nv_remainder(x, 3L)
#> AnvlArray
#> 1
#> 2
#> 0
#> [ CPUf32{3} ]