code: public static BigDecimal atanh(BigDecimal x, MathContext mathContext) {
          if (x.compareTo(BigDecimal.ONE) >= 0) {
              throw new ArithmeticException("Illegal atanh(x) for x >= 1: x = " + x);
          }
          if (x.compareTo(MINUS_ONE) <= 0) {
              throw new ArithmeticException("Illegal atanh(x) for x <= -1: x = " + x);
          }
  
  		checkMathContext(mathContext);
  		MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode());
  		BigDecimal result = log(ONE.add(x, mc).divide(ONE.subtract(x, mc), mc), mc).multiply(ONE_HALF, mc);
  		return round(result, mathContext);
  	}
docs: Calculates the arc hyperbolic tangens (inverse hyperbolic tangens) of {@link BigDecimal} x.
  
  <p>See: <a href="https://en.wikipedia.org/wiki/Hyperbolic_function">Wikipedia: Hyperbolic function</a></p>
  
  @param x the {@link BigDecimal} to calculate the arc hyperbolic tangens for
  @param mathContext the {@link MathContext} used for the result
  @return the calculated arc hyperbolic tangens {@link BigDecimal} with the precision specified in the <code>mathContext</code>
  @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision