code: public static DecimalType inferRoundType(int precision, int scale, int r) {
  		if (r >= scale) {
  			return new DecimalType(precision, scale);
  		} else if (r < 0) {
  			return new DecimalType(Math.min(38, 1 + precision - scale), 0);
  		} else { // 0 <= r < s
  			return new DecimalType(1 + precision - scale + r, r);
  		}
  		// NOTE: rounding may increase the digits by 1, therefore we need +1 on precisions.
  	}
docs: return type of Round( DECIMAL(p,s), r).