public static boolean fastIsLong(
      int fastSignum, long fast0, long fast1, long fast2,
      int fastIntegerDigitCount, int fastScale) {

    if (fastIntegerDigitCount < MAX_LONG_DIGITS) {

      // Definitely a long; most longs fall here
      return true;

    } else if (fastIntegerDigitCount > MAX_LONG_DIGITS) {

      // Definitely not a long.
      return false;

    } else if (fastScale == 0) {

      // From the above checks, we know fast2 is zero.

      if (fastSignum == 1) {
        FastHiveDecimal max = FASTHIVEDECIMAL_MAX_LONG_VALUE;
        if (fast1 > max.fast1 || (fast1 == max.fast1 && fast0 > max.fast0)) {
          return false;
        }
        return true;
      } else {
        FastHiveDecimal min = FASTHIVEDECIMAL_MIN_LONG_VALUE;
        if (fast1 > min.fast1 || (fast1 == min.fast1 && fast0 > min.fast0)) {
          return false;
        }
        return true;
      }

    } else {

      // We need to work a little harder for our comparison.  Note we round down for
      // integer conversion so anything below the next min/max will work.

      if (fastSignum == 1) {
        return
            (fastCompareTo(
                fastSignum, fast0, fast1, fast2, fastScale,
                FASTHIVEDECIMAL_MAX_LONG_VALUE_PLUS_ONE) < 0);
      } else {
        return
            (fastCompareTo(
                fastSignum, fast0, fast1, fast2, fastScale,
                FASTHIVEDECIMAL_MIN_LONG_VALUE_MINUS_ONE) > 0);
      }
    }
  }
Is the decimal value a long? Range -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
                                   Long.MIN_VALUE                Long.MAX_VALUE

Emulates testing for no value corruption:
     bigDecimalValue().setScale(0).equals(BigDecimal.valueOf(bigDecimalValue().longValue()))

NOTE: Fractional digits are ignored in the test since fastLongValueClip() will
      remove them (round down).

@param fastSignum the sign (-1, 0, or +1)
@param fast0 word 0 of the internal representation
@param fast1 word 1
@param fast2 word 2
@param fastIntegerDigitCount the number of integer digits
@param fastScale the scale of the number
@return True when fastLongValueClip() will return a correct long.
storage-api/src/java/org/apache/hadoop/hive/common/type/FastHiveDecimalImpl.java