public void checkPrecisionOverflow(int precision) {
    if (precision <= 0 || precision > 38) {
      throw new IllegalArgumentException("Invalid precision " + precision);
    }

    if (this.unscaledValue.compareTo(SqlMathUtil.POWER_TENS_INT128[precision]) >= 0) {
      SqlMathUtil.throwOverflowException();
    }
  }
Throws an exception if the value of this object exceeds the maximum value
for the given precision. Remember that underflow is not an error, but
overflow is an immediate error.

@param precision
         maximum precision
common/src/java/org/apache/hadoop/hive/common/type/Decimal128.java