Function arrow2::compute::arithmetics::basic::wrapping_sub
source · [−]pub fn wrapping_sub<T>(
lhs: &PrimitiveArray<T>,
rhs: &PrimitiveArray<T>
) -> PrimitiveArray<T> where
T: NativeArithmetics + WrappingSub<Output = T>,
Expand description
Wrapping subtraction of two PrimitiveArray
s.
It wraps around at the boundary of the type if the result overflows.
Examples
use arrow2::compute::arithmetics::basic::wrapping_sub;
use arrow2::array::PrimitiveArray;
let a = PrimitiveArray::from([Some(-100i8), Some(-100i8), Some(100i8)]);
let b = PrimitiveArray::from([Some(0i8), Some(100i8), Some(0i8)]);
let result = wrapping_sub(&a, &b);
let expected = PrimitiveArray::from([Some(-100i8), Some(56i8), Some(100i8)]);
assert_eq!(result, expected);