cpp/src/gandiva/precompiled/decimal_ops.cc
// Modify scale to drop all digits to the right of the decimal and round.
// Then, zero out 'rounding_scale' number of digits to the left of the decimal point.
Modify scale to drop all digits to the right of the decimal and round.
Then, zero out 'rounding_scale' number of digits to the left of the decimal point.
Modify scale to drop all digits to the right of the decimal and round . Then zero out ' rounding_scale ' number of digits to the left of the decimal point .
static BasicDecimal128 RoundWithNegativeScale(const BasicDecimalScalar128& x,
                                              int32_t out_precision,
                                              int32_t rounding_scale,
                                              RoundType round_type, bool* overflow) {
  DCHECK_LT(rounding_scale, 0);
  auto scaled = ModifyScaleAndPrecision(x, out_precision, 0, overflow);
  auto rounding_delta = ComputeRoundingDelta(scaled, 0, -rounding_scale, round_type);
  auto base = BasicDecimal128::GetScaleMultiplier(-rounding_scale);
  auto delta = rounding_delta * base - (scaled % base);
  DECIMAL_OVERFLOW_IF(BasicDecimal128::Abs(scaled) >
                          GetMaxValue(out_precision) - BasicDecimal128::Abs(delta),
                      overflow);
  return scaled + delta;
}
static BasicDecimal128 RoundWithNegativeScale ( const BasicDecimalScalar128 & x , int32_t out_precision , int32_t rounding_scale , RoundType round_type , bool * overflow ) { DCHECK_LT ( rounding_scale , 0 ) ; auto scaled = ModifyScaleAndPrecision ( x , out_precision , 0 , overflow ) ; auto rounding_delta = ComputeRoundingDelta ( scaled , 0 , - rounding_scale , round_type ) ; auto base = BasicDecimal128 :: GetScaleMultiplier ( - rounding_scale ) ; auto delta = rounding_delta * base - ( scaled % base ) ; DECIMAL_OVERFLOW_IF ( BasicDecimal128 :: Abs ( scaled ) > GetMaxValue ( out_precision ) - BasicDecimal128 :: Abs ( delta ) , overflow ) ; return scaled + delta ; }
Modify scale to drop all digits to the right of the decimal and round.
Modify scale to drop all digits to the right of the decimal and round .
// get rid of the fractional part.