Function polars::export::arrow::compute::arithmetics::basic::overflowing_mul
source · [−]pub fn overflowing_mul<T>(
lhs: &PrimitiveArray<T>,
rhs: &PrimitiveArray<T>
) -> (PrimitiveArray<T>, Bitmap) where
T: NativeArithmetics + OverflowingMul<Output = T>,
This is supported on crate feature
compute_arithmetics
only.Expand description
Overflowing multiplication of two primitive arrays. If the result from the mul overflows, the result for the operation will be an array with overflowed values and a validity array indicating the overflowing elements from the array.
Examples
use arrow2::compute::arithmetics::basic::overflowing_mul;
use arrow2::array::Int8Array;
let a = Int8Array::from(&[Some(1i8), Some(-100i8)]);
let b = Int8Array::from(&[Some(1i8), Some(100i8)]);
let (result, overflow) = overflowing_mul(&a, &b);
let expected = Int8Array::from(&[Some(1i8), Some(-16i8)]);
assert_eq!(result, expected);