public static boolean fastRoundFractionalUp(
      int fastSignum, long fast0, long fast1, long fast2,
      int scaleDown,
      FastHiveDecimal fastResult) {
    if (scaleDown < 1 || scaleDown > HiveDecimal.MAX_SCALE) {
      throw new IllegalArgumentException("Expecting scaleDown > 0 and scaleDown < " + HiveDecimal.MAX_SCALE + " (scaleDown " + scaleDown + ")");
    }

    if (scaleDown == HiveDecimal.MAX_SCALE) {

      // Examine all digits being thrown away to determine if result is 0 or 1.
      if (fast0 == 0 && fast1 == 0 && fast2 == 0) {

        // Zero result.
        fastResult.fastReset();
      } else {
        fastResult.fastSet(fastSignum, /* fast0 */ 1, 0, 0, /* fastIntegerDigitCount */ 1, 0);
      }
      return true;
    }

    boolean isRoundPortionAllZeroes =
        isRoundPortionAllZeroes(
            fast0, fast1, fast2,
            scaleDown);

    doFastScaleDown(
        fast0, fast1, fast2,
        scaleDown,
        fastResult);

    if (!isRoundPortionAllZeroes) {
      final long r0 = fastResult.fast0 + 1;
      fastResult.fast0 =
          r0 % MULTIPLER_LONGWORD_DECIMAL;
      final long r1 =
          fastResult.fast1
        + r0 / MULTIPLER_LONGWORD_DECIMAL;
      fastResult.fast1 =
          r1 % MULTIPLER_LONGWORD_DECIMAL;
      fastResult.fast2 =
          fastResult.fast2
        + r1 / MULTIPLER_LONGWORD_DECIMAL;
    }

    if (fastResult.fast0 == 0 && fastResult.fast1 == 0 && fastResult.fast2 == 0) {
      fastResult.fastSignum = 0;
      fastResult.fastIntegerDigitCount = 0;
      fastResult.fastScale = 0;
    } else {
      fastResult.fastSignum = fastSignum;
    }

    return (fastResult.fast2 <= MAX_HIGHWORD_DECIMAL);
  }
Fast decimal scale down by factor of 10 with rounding ROUND_UP.

When the fraction being scaled away is non-zero, the add 1.

@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 scaleDown the number of integer digits to scale
@param fastResult an object to reuse
@return was the operation successfule?
storage-api/src/java/org/apache/hadoop/hive/common/type/FastHiveDecimalImpl.java