public static BigInteger fastBigIntegerValueUnscaled(
      int fastSignum, long fast0, long fast1, long fast2) {

    if (fastSignum == 0) {
      return BigInteger.ZERO;
    }
    BigInteger result;
    if (fast2 == 0) {
      if (fast1 == 0) {
        result =
            BigInteger.valueOf(fast0);
      } else {
        result =
            BigInteger.valueOf(fast0).add(
                BigInteger.valueOf(fast1).multiply(BIG_INTEGER_LONGWORD_MULTIPLIER));
      }
    } else {
      result =
          BigInteger.valueOf(fast0).add(
              BigInteger.valueOf(fast1).multiply(BIG_INTEGER_LONGWORD_MULTIPLIER)).add(
                  BigInteger.valueOf(fast2).multiply(BIG_INTEGER_LONGWORD_MULTIPLIER_2X));
    }

    return (fastSignum == 1 ? result : result.negate());
  }
*********************************************************************************************
  // Decimal to Non-Integer conversion.

  public static float fastFloatValue(
      int fastSignum, long fast0, long fast1, long fast2,
      int fastIntegerDigitCount, int fastScale) {
    if (fastSignum == 0) {
      return 0;
    }
    BigDecimal bigDecimal = fastBigDecimalValue(
        fastSignum, fast0, fast1, fast2,
        fastIntegerDigitCount, fastScale);
    return bigDecimal.floatValue();
  }

  public static double fastDoubleValue(
      int fastSignum, long fast0, long fast1, long fast2,
      int fastIntegerDigitCount, int fastScale) {
    if (fastSignum == 0) {
      return 0;
    }

    // CONSIDER: Looked at the possibility of faster decimal to double conversion by using some
    //           of their lower level logic that extracts the various parts out of a double.
    //           The difficulty is Java's rounding rules are byzantine.

    BigDecimal bigDecimal = fastBigDecimalValue(
        fastSignum, fast0, fast1, fast2,
        fastIntegerDigitCount, fastScale);
    return bigDecimal.doubleValue();
  }

  /**
Get a BigInteger representing the decimal's digits without a dot.

@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
@param fastSerializationScale the scale to serialize
@return Returns a signed BigInteger.
storage-api/src/java/org/apache/hadoop/hive/common/type/FastHiveDecimalImpl.java