* @param div If div &lt; 2 it is set to 2. If div &gt; 256 it is set to
     * 256.
     * @param decimalPlaces
     * @param a_RoundingMode
     * @return x^y accurate to decimalPlaces
     */
    public static BigDecimal powerNoSpecialCaseCheck(
            BigDecimal x,
            BigInteger y,
            int div,
            int decimalPlaces,
            RoundingMode a_RoundingMode) {
        if (div < 2) {
            div = 2;
        } else {
            if (div > 256) {
                div = 256;
            }
        }
        BigInteger div_BigInteger = BigInteger.valueOf(div);
        BigDecimal result;// = BigDecimal.ONE;
        BigDecimal result0;
        BigDecimal result1;
        BigInteger y1 = new BigInteger(y.toString());
        BigInteger[] yDivideAndRemainder;
        if (y1.compareTo(div_BigInteger) != 1) {
            while (y1.compareTo(div_BigInteger) != 1) {
                div_BigInteger = div_BigInteger.divide(Generic_BigInteger.Two);
                div = div / 2;
            }
        }
        yDivideAndRemainder = y1.divideAndRemainder(div_BigInteger);
        if (yDivideAndRemainder[0].compareTo(BigInteger.ONE) == 0) {
            if (yDivideAndRemainder[1].compareTo(BigInteger.ZERO) == 0) {
                if (div < 6) {
                    result = power(
                            x,
                            y1.intValue(),
                            //a_MathContext,
                            decimalPlaces,
                            a_RoundingMode);
                    if (result.scale() > decimalPlaces) {
                        return roundIfNecessary(result, decimalPlaces, a_RoundingMode);
                    }
                    return result;
                } else {
                    div /= 2;
                    result = power(
                            x,
                            y,
                            div,
                            //a_MathContext,
                            decimalPlaces,
                            a_RoundingMode);
                    if (result.scale() > decimalPlaces) {
                        return roundIfNecessary(result, decimalPlaces, a_RoundingMode);
                    }
                    return result;
                }
            } else {
                if (div < 4) {
                    result0 = power(
                            x,
                            div,
                            //a_MathContext
                            decimalPlaces + div + 2,
                            //decimalPlaces,
                            a_RoundingMode);
                    //BigInteger remainingY = y1.subtract(yDivideAndRemainder[0].multiply(div_BigInteger));
                    BigInteger remainingY = yDivideAndRemainder[1];
                    result1 = power(
                            x,
                            remainingY.intValue(),
                            //a_MathContext,
                            decimalPlaces + remainingY.intValue() + 2,
                            //decimalPlaces,
                            a_RoundingMode);
                    result = multiplyRoundIfNecessary(
                            result0,
                            result1,
                            //a_MathContext,
                            decimalPlaces,
                            a_RoundingMode);
                    return result;
                } else {
                    result0 = power(
                            x,
                            div_BigInteger,
                            div,
                            decimalPlaces + div + 2,
                            //decimalPlaces + 6,
                            a_RoundingMode);
                    //BigInteger remainingY = y1.subtract(yDivideAndRemainder[0].multiply(div_BigInteger));
                    BigInteger remainingY = yDivideAndRemainder[1];
                    result1 = power(
                            x,
                            remainingY.intValue(),
                            div,
                            //a_MathContext,
                            decimalPlaces + remainingY.intValue() + 2,
                            //decimalPlaces,
                            a_RoundingMode);
                    result = multiplyRoundIfNecessary(
                            result0,
                            result1,
                            decimalPlaces,
                            a_RoundingMode);
                    return result;
                }
            }
        }
        result0 = power(
                x,
                div_BigInteger,
                div,
                decimalPlaces + div + 2,
                //decimalPlaces,
                a_RoundingMode);
        result0 = power(
                result0,
                yDivideAndRemainder[0],
                div,
                decimalPlaces + yDivideAndRemainder[0].intValue() + 2,
                //decimalPlaces + 4,
                a_RoundingMode);
        //BigInteger remainingY = y1.subtract(yDivideAndRemainder[0].multiply(div_BigInteger));
        BigInteger remainingY = yDivideAndRemainder[1];
        result1 = power(
                x,
                remainingY,
                div,
                decimalPlaces + remainingY.intValue() + 2,
                //decimalPlaces + 2,
                a_RoundingMode);
        result = multiplyRoundIfNecessary(
                result0,
                result1,
                decimalPlaces,
                a_RoundingMode);
        return result;
    }