This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients mark.dickinson
Date 2021-08-21.13:26:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1629552403.37.0.715300348368.issue44970@roundup.psfhosted.org>
In-reply-to
Content
Complex power, both via `**` and the built-in `pow`, and via `cmath.pow`, is currently a bit of a mess when it comes to special-case handling - particularly handling of signed zeros, infinities, NaNs, and overflow.

At some point it would be nice to rationalise and document the special-case handling, as far as possible, and to make the behaviour of `**` and `pow` consistent with that of `cmath.pow`. Note that while for all the other cmath functions we have good guidance from the C standards on how special cases should be handled, for pow we're on our own - the C standard refuses to specify anything at all about special case handling.

Note also that there are a *lot* of special cases to consider. We have four real input parameters (the real and imaginary parts of each of the base and the exponent), each of which can be one of the 7 cases nan, -inf, -finite, -0.0, 0.0, finite, inf, for a total of 7**4 = 2401 combinations; moreover, for some cases we might need to distinguish integral from non-integral values, and even integers from odd integers.

This is low priority - in many years of mathematical, scientific and numeric work, I've seen little evidence that anyone actually cares about or uses general complex power. Most users are interested in one or more subcases, like:

- positive real base and complex exponent
- complex base and integral exponent
- complex nth root for positive integers n, especially for small n (square root, cube root, ...)

So a possibly more manageable and more useful subtask would be to ensure that special cases are handled in a sensible manner for these subcases.
History
Date User Action Args
2021-08-21 13:26:43mark.dickinsonsetrecipients: + mark.dickinson
2021-08-21 13:26:43mark.dickinsonsetmessageid: <1629552403.37.0.715300348368.issue44970@roundup.psfhosted.org>
2021-08-21 13:26:43mark.dickinsonlinkissue44970 messages
2021-08-21 13:26:43mark.dickinsoncreate