When BigComplexMath.sqrt is invoked with an argument that has a negative or zero real part and a zero imaginary part, it throws an ArithmeticException:
BigComplexMath.sqrt(BigComplex.ONE.negate(), MathContext.DECIMAL64)
Exception in thread "main" java.lang.ArithmeticException: Division undefined
at java.base/java.math.BigDecimal.divide(BigDecimal.java:1831)
at ch.obermuhlner.math.big.BigComplex.divide(BigComplex.java:287)
at ch.obermuhlner.math.big.BigComplexMath.sqrt(BigComplexMath.java:289)
Expected behaviour:
BigComplexMath.sqrt should not throw an ArithmeticException but compute the result (in the above case 0 + 1i) instead.
When
BigComplexMath.sqrtis invoked with an argument that has a negative or zero real part and a zero imaginary part, it throws anArithmeticException:Expected behaviour:
BigComplexMath.sqrtshould not throw anArithmeticExceptionbut compute the result (in the above case0 + 1i) instead.