SciProgCentre/kmath

Taking the power of a complex zero results in NaN instead of 0

Opened this issue · 1 comments

To reproduce:

ComplexField.power(Complex(0.0), Complex(2.0))

I created my own version of this function and ended up with the same problem, which was caused by me not testing for the special case of the base being zero. After I fixed it, I still failed on this:

ComplexField.power(Complex(-0.0), Complex(2.0))

I mention this here since in case you want to add a special test case for this.

Thanks. I've reproduced it and fixed in the last commit. It would be great if you could add more tests. Even better if you could create pull/merge requests.