private void verifyMultiplyDivideInverse(long a, long b) {
    final short scale = 0;

    // ignore zero-divide cases
    if (b == 0) {
      return;
    }
    Decimal128 decA = new Decimal128(a, scale);
    Decimal128 decB = new Decimal128(b, scale);
    decA.multiplyDestructive(decB, scale);
    decA.checkPrecisionOverflow(38); // caller must make sure product of inputs is not too big
    decA.divideDestructive(decB, scale);
    assertEquals("Error for a = " + Long.toString(a) + ", b = " + Long.toString(b),
        new Decimal128(a, scale), decA);
  }
Verify that a * b / b == a
for decimal division for scale 0 with integer inputs.

Not valid if abs(a * b) >= 10**38.
common/src/test/org/apache/hadoop/hive/common/type/TestDecimal128.java