divmod#
- class saiunit.math.divmod(x, y, **kwargs)#
Return element-wise quotient and remainder simultaneously.
Equivalent to
(x // y, x % y), but faster because it avoids redundant work. The quotient carries unitx.unit / y.unitand the remainder carriesx.unit.- Parameters:
- Return type:
Tuple[saiunit.Quantity |Array|ndarray|bool|number|bool|int|float|complex, saiunit.Quantity |Array|ndarray|bool|number|bool|int|float|complex]- Returns:
out1 (ndarray or Quantity) – Element-wise quotient resulting from floor division. Unit is
x.unit / y.unit.out2 (ndarray or Quantity) – Element-wise remainder from floor division. Unit is
x.unit.
Examples
>>> import saiunit as u >>> a = u.math.array([7.0, 9.0]) * u.meter >>> b = u.math.array([2.0, 4.0]) * u.second >>> quotient, remainder = u.math.divmod(a, b)