* @param decimalPlaces
     * @param a_RoundingMode
     * @return the natural logarithm of x accurate to decimalPlaces number of
     * decimal places and with result rounded using a_RoundingMode if necessary.
     */
    public static BigDecimal ln(
            BigDecimal x,
            Generic_BigDecimal a_Generic_BigDecimal,
            int decimalPlaces,
            RoundingMode a_RoundingMode) {
        // Check that x > 0.
        if (x.compareTo(BigDecimal.ZERO) != 1) {
            throw new IllegalArgumentException(
                    "x <= 0 in " + BigDecimal.class.getName()
                    + "ln(BigDecimal,Generic_BigDecimal,int,RoundingMode)");
        }
        // The number of digits to the left of the decimal point.
        int magnitude = x.toString().length() - x.scale() - 1;
        if (magnitude < 3) {
            return lnNewton(
                    x, a_Generic_BigDecimal, decimalPlaces, a_RoundingMode);
        } else {
            // Compute magnitude*ln(x^(1/magnitude)).
            // x^(1/magnitude)
            BigDecimal root = rootRoundIfNecessary(x, magnitude, decimalPlaces, a_RoundingMode);
            // ln(x^(1/magnitude))
            BigDecimal lnRoot = lnNewton(
                    root, a_Generic_BigDecimal, decimalPlaces, a_RoundingMode);
            //BigDecimal lnRoot = ln(rootRoundIfNecessary, a_Generic_BigDecimal, decimalPlaces, a_RoundingMode);
            // magnitude*ln(x^(1/magnitude))
            BigDecimal result = BigDecimal.valueOf(magnitude).multiply(lnRoot);
            return result;
            //setScale(scale, BigDecimal.ROUND_HALF_EVEN);
        }
    }