private static BigDecimal trim(BigDecimal d) {
    if (d.compareTo(BigDecimal.ZERO) == 0) {
      // Special case for 0, because java doesn't strip zeros correctly on that number.
      d = BigDecimal.ZERO;
    } else {
      d = d.stripTrailingZeros();
      if (d.scale() < 0) {
        // no negative scale decimals
        d = d.setScale(0);
      }
    }
    return d;
  }
Get the sign of the underlying decimal.
@return 0 if the decimal is equal to 0, -1 if less than zero, and 1 if greater than 0
storage-api/src/java/org/apache/hadoop/hive/common/type/HiveDecimalV1.java