public ExtDecimal ln(int scale, RoundingMode rm) {
        if (type == Type.NUMBER) {
            if (compareTo(ZERO) < 0) {
                throw new ArithmeticException("Logarithm of a negative number in a real context");
            } else if (compareTo(ZERO) == 0) {
                throw new ArithmeticException("Logarithm of 0");
            } else if (compareTo(ONE) == 0) {
                return ZERO;
            } else if (compareTo(E) == 0) {
                return ONE;
            } else {
                ExtDecimal sum = ExtDecimal.ZERO;
                int limit = scale;
                for (int i = 0; i <= limit; i++) {
                    ExtDecimal augend = this.dec().divide(this.inc(), scale + 2, RoundingMode.HALF_DOWN).pow(2 * i + 1).divide(ExtDecimal.valueOf(2 * i + 1), scale + 2, RoundingMode.HALF_UP);
                    //System.out.println(augend);
                    sum = sum.add(augend);
                }
                return sum.multiply(ExtDecimal.TWO).setScale(scale, RoundingMode.DOWN);
            }
        } else if (type == Type.POSITIVEZERO) {
            return NEGATIVEINFINITY;
        } else if (type == Type.INFINITY) {
            return INFINITY;
        } else {
            throw new UnsupportedOperationException("exp of ".toString());
        }
    }