* return the most (biggest) significant digit
     */
    public static int positionSignificantDigit(
            BigDecimal x) {
        int result;
        // Deal with special cases
        if (x.compareTo(BigDecimal.ZERO) == -1) {
            result = positionSignificantDigit(x.negate());
            return result;
        }
//        if (x.compareTo(BigDecimal.ONE) == -1) {
//            result = 0;
//            BigDecimal movedRight;
//            if (x.compareTo(BigDecimal.ZERO) == 1
//                    && x.compareTo(BigDecimal.ONE) == -1) {
//                result += 1;
//                movedRight = x.movePointRight(1);
//                while (movedRight.compareTo(BigDecimal.ONE) == -1) {
//                    result += 1;
//                    movedRight = movedRight.movePointRight(1);
//                }
//            }
//            return result;
//        }
        BigInteger xUnscaledValue = x.unscaledValue();
        String xUnscaledValueString = xUnscaledValue.toString();
        result = xUnscaledValueString.length() - x.scale();
        if (result < 1) {
            result--;
        }

        return result;
    }