code: public BigDecimal calculate(BigDecimal x, MathContext mathContext) {
  		BigDecimal acceptableError = ONE.movePointLeft(mathContext.getPrecision() + 1);
  
  		PowerIterator powerIterator = createPowerIterator(x, mathContext);
  		
  		BigDecimal sum = BigDecimal.ZERO;
  		BigDecimal step;
  		int i = 0;
  		do {
  			BigRational factor = getFactor(i);
  			BigDecimal xToThePower  = powerIterator.getCurrentPower();
  			powerIterator.calculateNextPower();
  			step = factor.getNumerator().multiply(xToThePower, mathContext).divide(factor.getDenominator(), mathContext);
  			i++;
  
  			if (calculateInPairs) {
  				xToThePower  = powerIterator.getCurrentPower();
  				powerIterator.calculateNextPower();
  				factor = getFactor(i);
  				BigDecimal step2 = factor.getNumerator().multiply(xToThePower, mathContext).divide(factor.getDenominator(), mathContext);
  				step = step.add(step2, mathContext);
  				i++;
  			}
  
  			sum = sum.add(step, mathContext);
  			//System.out.println(sum + " " + step);
  		} while (step.abs().compareTo(acceptableError) > 0);
  		
  		return sum.round(mathContext);
  	}
docs: Calculates the series for the specified value x and the precision defined in the {@link MathContext}.
  
  @param x the value x
  @param mathContext the {@link MathContext}
  @return the calculated result