pub fn saturating_mul<T>(
    lhs: &PrimitiveArray<T>,
    rhs: &PrimitiveArray<T>
) -> PrimitiveArray<T> where
    T: NativeArithmetics + SaturatingMul<Output = T>, 
Available on crate feature compute_arithmetics only.
Expand description

Saturating multiplication of two primitive arrays. If the result from the multiplication overflows, the result for the operation will be the saturated value.

Examples

use arrow2::compute::arithmetics::basic::saturating_mul;
use arrow2::array::Int8Array;

let a = Int8Array::from(&[Some(-100i8)]);
let b = Int8Array::from(&[Some(100i8)]);
let result = saturating_mul(&a, &b);
let expected = Int8Array::from(&[Some(-128)]);
assert_eq!(result, expected);