kmath icon indicating copy to clipboard operation
kmath copied to clipboard

ComplexField.power gives invalid return values for negative integer reals with a real power

Open lokedhs opened this issue 1 year ago • 2 comments

Example:

ComplexField.power(Complex(-3.0, 0.0), 0.5)

This results in a complex result where both the real and imaginary parts are NaN.

Workaround:

ComplexField(Complex(-3.0, 0.0), Complex(0.5, 0.0))

lokedhs avatar Feb 07 '24 17:02 lokedhs

Thank you, I've reproduced it on the latest build.

SPC-code avatar Feb 07 '24 18:02 SPC-code

Thanks again, the problem was in optimization made for complex numbers without real part: https://github.com/SciProgCentre/kmath/commit/8a754ace199d84959978b78fb1b175595a1d7af3.

SPC-code avatar Feb 07 '24 18:02 SPC-code