* is thrown
     */
    public static BigDecimal reciprocalWillBeIntegerReturnBigDecimal(
            BigDecimal x) {
        return BigDecimal.ONE.divide(
                x,
                0,
                RoundingMode.UNNECESSARY);
    }

//    /**
//     * Adapted from http://everything2.com/index.pl?node_id=946812
//     * @param x
//     * @param decimalPlaces
//     * @return
//     */
//    public BigDecimal lg(
//            BigDecimal x,
//            int decimalPlaces) {
//        final int NUM_OF_DIGITS = decimalPlaces + 2;
//        // need to add one to get the right number of decimalPlaces
//        //  and then add one again to get the next number
//        //  so I can round it correctly.
//        MathContext mc = new MathContext(NUM_OF_DIGITS, RoundingMode.HALF_EVEN);
//        //special conditions:
//        // log(-toCompare) -> exception
//        // log(1) == 0 exactly;
//        // log of a number lessthan one = -log(1/toCompare)
//        if (x.signum() <= 0) {
//            throw new ArithmeticException("log of a negative number! (or zero)");
//        } else if (x.compareTo(BigDecimal.ONE) == 0) {
//            return BigDecimal.ZERO;
//        } else if (x.compareTo(BigDecimal.ONE) < 0) {
//            return (lg((BigDecimal.ONE).divide(x, mc), decimalPlaces)).negate();
//        }
//        StringBuffer sb = new StringBuffer();
//        //number of digits on the left of the decimal point
//        int leftDigits = x.precision() - x.scale();
//        //so, the first digits of the log10 are:
//        sb.append(leftDigits - 1).append(".");
//        //this is the algorithm outlined in the webpage
//        int n = 0;
//        while (n < NUM_OF_DIGITS) {
//            x = (x.movePointLeft(leftDigits - 1)).pow(10, mc);
//            leftDigits = x.precision() - x.scale();
//            sb.append(leftDigits - 1);
//            n++;
//        }
//        BigDecimal ans = new BigDecimal(sb.toString());
//        //Round the number to the correct number of decimal places.
//        ans = ans.round(new MathContext(ans.precision() - ans.scale() + decimalPlaces, RoundingMode.HALF_EVEN));
//        return ans;
//    }