Function arrow2::compute::arithmetics::basic::checked_div
source · [−]pub fn checked_div<T>(
lhs: &PrimitiveArray<T>,
rhs: &PrimitiveArray<T>
) -> PrimitiveArray<T> where
T: NativeArithmetics + CheckedDiv<Output = T>,
Expand description
Checked division of two primitive arrays. If the result from the division overflows, the result for the operation will change the validity array making this operation None
Examples
use arrow2::compute::arithmetics::basic::checked_div;
use arrow2::array::Int8Array;
let a = Int8Array::from(&[Some(-100i8), Some(10i8)]);
let b = Int8Array::from(&[Some(100i8), Some(0i8)]);
let result = checked_div(&a, &b);
let expected = Int8Array::from(&[Some(-1i8), None]);
assert_eq!(result, expected);