public static int fastLongWordPrecision(
      long longWord) {

    if (longWord == 0) {
      return 0;
    }
    // Search like binary search to minimize comparisons.
    if (longWord > 99999999L) {
      if (longWord > 999999999999L) {
        if (longWord > 99999999999999L) {
          if (longWord > 999999999999999L) {
            return 16;
          } else {
            return 15;
          }
        } else {
          if (longWord > 9999999999999L) {
            return 14;
          } else {
            return 13;
          }
        }
      } else {
        if (longWord > 9999999999L) {
          if (longWord > 99999999999L) {
            return 12;
          } else {
            return 11;
          }
        } else {
          if (longWord > 999999999L) {
            return 10;
          } else {
            return 9;
          }
        }
      }
    } else {
      if (longWord > 9999L) {
        if (longWord > 999999L) {
          if (longWord > 9999999L) {
            return 8;
          } else {
            return 7;
          }
        } else {
          if (longWord > 99999L) {
            return 6;
          } else {
            return 5;
          }
        }
      } else {
        if (longWord > 99L) {
          if (longWord > 999L) {
            return 4;
          } else {
            return 3;
          }
        } else {
          if (longWord > 9L) {
            return 2;
          } else {
            return 1;
          }
        }
      }
    }
  }
Fast decimal scale up by factor of 10.
@param fast0 word 0 of the internal representation
@param fast1 word 1
@param fast2 word 2
@param scaleUp the number of integer digits to scale up by
@param fastResult an object to reuse
@return was the operation successfule?
storage-api/src/java/org/apache/hadoop/hive/common/type/FastHiveDecimalImpl.java