[issue44698] Undefined behaviour in Objects/complexobject.c's complex_pow

Mark Dickinson report at bugs.python.org
Wed Aug 4 15:19:17 EDT 2021


Mark Dickinson <dickinsm at gmail.com> added the comment:

> brave or foolhardy enough to try to figure out what all of the special case results *should* be for complex pow

Addendum: even the C standards give up at this point. For everything else the special cases are spelled out in detail, but for cpow, from §G.6.4.1 of C17 (in Annex G), we have:

> The cpow functions raise floating-point exceptions if appropriate for the calculation of the parts of the result, and may also raise spurious floating-point exceptions.

And that's it. (Well, not quite: there's a footnote, which says:

> This allows cpow(z, c) to be implemented as cexp(cclog(z)) without precluding implementations that treat special cases more carefully.

)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44698>
_______________________________________


More information about the Python-bugs-list mailing list