BigComplex { public BigDecimal angle(MathContext mathContext) { return BigDecimalMath.atan2(im, re, mathContext); } private  BigComplex(BigDecimal re, BigDecimal im); BigComplex add(BigComplex value); BigComplex add(BigComplex value, MathContext mathContext); BigComplex add(BigDecimal value, MathContext mathContext); BigComplex add(BigDecimal value); BigComplex add(double value); BigComplex subtract(BigComplex value); BigComplex subtract(BigComplex value, MathContext mathContext); BigComplex subtract(BigDecimal value, MathContext mathContext); BigComplex subtract(BigDecimal value); BigComplex subtract(double value); BigComplex multiply(BigComplex value); BigComplex multiply(BigComplex value, MathContext mathContext); BigComplex multiply(BigDecimal value, MathContext mathContext); BigComplex multiply(BigDecimal value); BigComplex multiply(double value); BigComplex divide(BigComplex value, MathContext mathContext); BigComplex divide(BigDecimal value, MathContext mathContext); BigComplex divide(double value, MathContext mathContext); BigComplex reciprocal(MathContext mathContext); BigComplex conjugate(); BigComplex negate(); BigDecimal abs(MathContext mathContext); BigDecimal angle(MathContext mathContext); BigDecimal absSquare(MathContext mathContext); boolean isReal(); BigComplex re(); BigComplex im(); BigComplex round(MathContext mathContext); @Override int hashCode(); @Override boolean equals(Object obj); boolean strictEquals(Object obj); @Override String toString(); static BigComplex valueOf(BigDecimal real); static BigComplex valueOf(double real); static BigComplex valueOf(double real, double imaginary); static BigComplex valueOf(BigDecimal real, BigDecimal imaginary); static BigComplex valueOfPolar(BigDecimal radius, BigDecimal angle, MathContext mathContext); static BigComplex valueOfPolar(double radius, double angle, MathContext mathContext); static final BigComplex ZERO; static final BigComplex ONE; static final BigComplex I; final BigDecimal re; final BigDecimal im; }
@Test(expected = ArithmeticException.class) public void testAngleFailZero() { assertCompareTo(BigDecimal.ZERO, BigComplex.ZERO.angle(MC)); }
@Test public void testAngle() { assertCompareTo(BigDecimal.ZERO, BigComplex.ONE.angle(MC)); assertCompareTo(BigDecimalMath.pi(MC_LARGE).divide(BigDecimal.valueOf(2), MC), BigComplex.I.angle(MC)); }