BigComplexMath { public static BigComplex atan(BigComplex x, MathContext mathContext) { MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); return log(I.subtract(x, mc).divide(I.add(x, mc), mc), mc).divide(I, mc).divide(TWO, mc).round(mathContext); }  static BigComplex reciprocal(BigComplex x, MathContext mathContext); static BigComplex conjugate(BigComplex x); static BigDecimal abs(BigComplex x, MathContext mathContext); static BigDecimal absSquare(BigComplex x, MathContext mathContext); static BigDecimal angle(BigComplex x, MathContext mathContext); static BigComplex factorial(BigComplex x, MathContext mathContext); static BigComplex gamma(BigComplex x, MathContext mathContext); static BigComplex exp(BigComplex x, MathContext mathContext); static BigComplex sin(BigComplex x, MathContext mathContext); static BigComplex cos(BigComplex x, MathContext mathContext); static BigComplex tan(BigComplex x, MathContext mathContext); static BigComplex atan(BigComplex x, MathContext mathContext); static BigComplex acot(BigComplex x, MathContext mathContext); static BigComplex asin(BigComplex x, MathContext mathContext); static BigComplex acos(BigComplex x, MathContext mathContext); static BigComplex sqrt(BigComplex x, MathContext mathContext); static BigComplex log(BigComplex x, MathContext mathContext); static BigComplex pow(BigComplex x, long y, MathContext mathContext); static BigComplex pow(BigComplex x, BigDecimal y, MathContext mathContext); static BigComplex pow(BigComplex x, BigComplex y, MathContext mathContext); static BigComplex root(BigComplex x, BigDecimal n, MathContext mathContext); static BigComplex root(BigComplex x, BigComplex n, MathContext mathContext);  }
@Test public void testAtan() { assertPrecisionCalculation( BigComplex.valueOf(new BigDecimal("1.3389725222944935611241935759091442410843161725444927785"), new BigDecimal("0.40235947810852509365018983330654690988140033856712943047")).round(MC), (mc) -> BigComplexMath.atan(BigComplex.valueOf(1, 2), mc), 5); }