private void verifyHighPrecisionMultiplySingle() {

    Decimal128 a, b, r;
    String sA, sB;

    Random rand = new Random();
    int aDigits = rand.nextInt(37) + 1; // number of digits in a (1..37)
    int bDigits = 38 - aDigits;         // number of digits in b (1..37)
    assertTrue(aDigits + bDigits == 38 && aDigits > 0 && bDigits > 0);

    a = new Decimal128();
    sA = makeNumericString(aDigits);
    a.update(sA, (short) 0);
    b = new Decimal128();
    sB = makeNumericString(bDigits);
    b.update(sB, (short) 0);

    r = new Decimal128();
    r.addDestructive(a, (short) 0);
    r.multiplyDestructive(b, (short) 0);

    String res1 = r.toFormalString();

    // Now do the operation with Java BigDecimal
    BigDecimal bdA = new BigDecimal(sA);
    BigDecimal bdB = new BigDecimal(sB);
    BigDecimal bdR = bdA.multiply(bdB);

    String res2 = bdR.toPlainString();

    // Compare the results
    String message = "For operation " + a.toFormalString() + " * " + b.toFormalString();
    assertEquals(message, res2, res1);
  }
During earlier code testing, if we found errors, test them here as regression tests.
common/src/test/org/apache/hadoop/hive/common/type/TestDecimal128.java