pub fn mul(lhs: &PrimitiveArray<i128>, rhs: &PrimitiveArray<i128>) -> PrimitiveArray<i128> {
    let (precision, scale) = get_parameters(lhs.data_type(), rhs.data_type()).unwrap();

    let scale = 10i128.pow(scale as u32);
    let max = max_value(precision);

    let op = move |a: i128, b: i128| {
        // The multiplication between i128 can overflow if they are
        // very large numbers. For that reason a checked
        // multiplication is used.
        let res: i128 = a.checked_mul(b).expect("Mayor overflow for multiplication");

        // The multiplication is done using the numbers without scale.
        // The resulting scale of the value has to be corrected by
        // dividing by (10^scale)

        //   111.111 -->      111111
        //   222.222 -->      222222
        // --------          -------
        // 24691.308 <-- 24691308642
        let res = res / scale;

        assert!(
            res.abs() <= max,
            "Overflow in multiplication presented for precision {}",
            precision
        );

        res
    };

    binary(lhs, rhs, lhs.data_type().clone(), op)
}
/// Multiply two decimal primitive arrays with the same precision and scale. If
/// the precision and scale is different, then an InvalidArgumentError is
/// returned. This function panics if the multiplied numbers result in a number
/// larger than the possible number for the selected precision.
///
/// # Examples
/// ```
/// use arrow2::compute::arithmetics::decimal::mul;
/// use arrow2::array::PrimitiveArray;
/// use arrow2::datatypes::DataType;
///
/// let a = PrimitiveArray::from([Some(1_00i128), Some(1_00i128), None, Some(2_00i128)]).to(DataType::Decimal(5, 2));
/// let b = PrimitiveArray::from([Some(1_00i128), Some(2_00i128), None, Some(2_00i128)]).to(DataType::Decimal(5, 2));
///
/// let result = mul(&a, &b);
/// let expected = PrimitiveArray::from([Some(1_00i128), Some(2_00i128), None, Some(4_00i128)]).to(DataType::Decimal(5, 2));
///
/// assert_eq!(result, expected);
/// ```
Multiply two decimal primitive arrays with the same precision and scale. If
the precision and scale is different, then an InvalidArgumentError is
returned. This function panics if the multiplied numbers result in a number
larger than the possible number for the selected precision.
Multiply two decimal primitive arrays with the same precision and scale . If the precision and scale is different then an InvalidArgumentError is returned . This function panics if the multiplied numbers result in a number larger than the possible number for the selected precision .
pub fn mul(lhs: &PrimitiveArray<i128>, rhs: &PrimitiveArray<i128>) -> PrimitiveArray<i128> {
    let (precision, scale) = get_parameters(lhs.data_type(), rhs.data_type()).unwrap();
    let scale = 10i128.pow(scale as u32);
    let max = max_value(precision);
    let op = move |a: i128, b: i128| {
        // The multiplication between i128 can overflow if they are
        // very large numbers. For that reason a checked
        // multiplication is used.
        let res: i128 = a.checked_mul(b).expect("Mayor overflow for multiplication");
        // The multiplication is done using the numbers without scale.
        // The resulting scale of the value has to be corrected by
        // dividing by (10^scale)
        //   111.111 -->      111111
        //   222.222 -->      222222
        // --------          -------
        // 24691.308 <-- 24691308642
        let res = res / scale;
        assert!(
            res.abs() <= max,
            "Overflow in multiplication presented for precision {}",
            precision
        );
        res
    };
    binary(lhs, rhs, lhs.data_type().clone(), op)
}
pub fn mul ( lhs : & PrimitiveArray < i128 > , rhs : & PrimitiveArray < i128 > ) -> PrimitiveArray < i128 > { let ( precision , scale ) = get_parameters ( lhs . data_type ( ) , rhs . data_type ( ) ) . unwrap ( ) ; let scale = 10i128 . pow ( scale as u32 ) ; let max = max_value ( precision ) ; let op = move | a : i128 , b : i128 | { // The multiplication between i128 can overflow if they are // very large numbers. For that reason a checked // multiplication is used. let res : i128 = a . checked_mul ( b ) . expect ( " " ) ; // The multiplication is done using the numbers without scale. // The resulting scale of the value has to be corrected by // dividing by (10^scale) //   111.111 -->      111111 //   222.222 -->      222222 // --------          ------- // 24691.308 <-- 24691308642 let res = res / scale ; assert ! ( res abs ( ) max " " precision ) ; res } ; binary ( lhs , rhs , lhs . data_type ( ) . clone ( ) , op ) }
Multiply two decimal primitive arrays with the same precision and scale.
Multiply two decimal primitive arrays with the same precision and scale .
lhs
&PrimitiveArray<i128>
rhs
&PrimitiveArray<i128>
lhs
&PrimitiveArray<i128>
rhs
&PrimitiveArray<i128>
examples
```
use arrow2::compute::arithmetics::decimal::mul;
use arrow2::array::PrimitiveArray;
use arrow2::datatypes::DataType.





assert_eq!(result, expected);
```
` ` ` use arrow2 :: compute :: arithmetics :: decimal :: mul ; use arrow2 :: array :: PrimitiveArray ; use arrow2 :: datatypes :: DataType . assert_eq! ( result expected ) ; ` ` `