Skip to main content

divmod

Function divmod 

Source
pub fn divmod<T>(x: &Array<T>, y: &Array<T>) -> Result<(Array<T>, Array<T>)>
where T: Float + Clone,
Expand description

Element-wise quotient and remainder

§Parameters

  • x - Dividend array
  • y - Divisor array

§Returns

Tuple of (quotient, remainder) arrays

§Examples

let x = Array::from_vec(vec![7.0, -7.0, 8.0]);
let y = Array::from_vec(vec![3.0, 3.0, 3.0]);
let (quot, rem) = divmod(&x, &y)?;
// quot = [2.0, -2.0, 2.0]
// rem = [1.0, -1.0, 2.0]