cpp/src/gandiva/precompiled/decimal_ops.cc
// Multiply when the out_precision is 38, and there is no trimming of the scale i.e
// the intermediate value is the same as the final value.
Multiply when the out_precision is 38, and there is no trimming of the scale i.e
the intermediate value is the same as the final value.
Multiply when the out_precision is 38 and there is no trimming of the scale i . e the intermediate value is the same as the final value .
static BasicDecimal128 MultiplyMaxPrecisionNoScaleDown(const BasicDecimalScalar128& x,
                                                       const BasicDecimalScalar128& y,
                                                       int32_t out_scale,
                                                       bool* overflow) {
  DCHECK_EQ(x.scale() + y.scale(), out_scale);
  BasicDecimal128 result;
  auto x_abs = BasicDecimal128::Abs(x.value());
  auto y_abs = BasicDecimal128::Abs(y.value());
  if (x_abs > BasicDecimal128::GetMaxValue() / y_abs) {
    *overflow = true;
  } else {
    *overflow = false;
    result = x.value() * y.value();
  }
  return result;
}
static BasicDecimal128 MultiplyMaxPrecisionNoScaleDown ( const BasicDecimalScalar128 & x , const BasicDecimalScalar128 & y , int32_t out_scale , bool * overflow ) { DCHECK_EQ ( x . scale ( ) + y . scale ( ) , out_scale ) ; BasicDecimal128 result ; auto x_abs = BasicDecimal128 :: Abs ( x . value ( ) ) ; auto y_abs = BasicDecimal128 :: Abs ( y . value ( ) ) ; if ( x_abs > BasicDecimal128 :: GetMaxValue ( ) / y_abs ) { * overflow = true ; } else { * overflow = false ; result = x . value ( ) * y . value ( ) ; } return result ; }
Multiply when the out_precision is 38, and there is no trimming of the scale i.e
the intermediate value is the same as the final value.
Multiply when the out_precision is 38 and there is no trimming of the scale i . e the intermediate value is the same as the final value .
// We've verified that the result will fit into 128 bits.