[issue44970] Re-examine complex pow special case handling

2021-10-22 Thread Mark Dickinson
Mark Dickinson added the comment: > Is not it a duplicate of issue15996? Yes, I think it's close enough. Thanks. -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> pow() for complex numbers is rough around the edges ___

[issue44970] Re-examine complex pow special case handling

2021-10-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Is not it a duplicate of issue15996? -- ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue44970] Re-examine complex pow special case handling

2021-08-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The OverflowError should only be raised if finite arguments produce infinite result. Py_ADJUST_ERANGE2 is used improperly. But after fixing this error I get (nan+infj) for z**1, the same as for z*1. -- nosy: +serhiy.storchaka _

[issue44970] Re-examine complex pow special case handling

2021-08-21 Thread Mark Dickinson
Mark Dickinson added the comment: Aargh. Brain fail. There *is* no `cmath.pow`, of course; this issue applies only to `**` and the built-in `pow`. -- ___ Python tracker ___ _

[issue44970] Re-examine complex pow special case handling

2021-08-21 Thread Mark Dickinson
Mark Dickinson added the comment: Here's just one example that doesn't make a whole lot of sense: in this case, z ** 1 should be returning z. >>> z = complex(3, float("inf")) >>> z ** 1 Traceback (most recent call last): File "", line 1, in OverflowError: complex exponentiation --

[issue44970] Re-examine complex pow special case handling

2021-08-21 Thread Mark Dickinson
New submission from Mark Dickinson : 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 rationa