Conversation
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
I don't understand why you need additional variable, instead of using BTW, probably you can get rid of using
No, I don't think so. This "API" was available as an accident. It's soft-deprecated, that means we will not enhance it further. See also capi-workgroup/decisions#56. |
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
|
Sergey, I added some of your code and ideas from 118000. You are welcome to take anything you want from here and add it to your PR if you like. I modified your cpow.pycpowi.pyI want to look into the results more carefully, but here's a quick summary:
Also, I made a performance test: powperftest.py
I'm happy to wait on the complex part of the errno stuff until 118000 is resolved. Also, I'd like to see 153148 (fix for atan2 for Intel math library and Solaris) merged. I think that will show some amount of acceptance for removing errno. (BTW, I would suggest backporting 153148 to Python 3.14 and 3.15, but I guess there's a robot to do that if wanted.) |
|
Note, that you can configure gmpy2 to raise exceptions like Python: >>> from gmpy2 import *
>>> mpc(0)**-1
mpc('inf+nanj')
>>> ctx = get_context()
>>> ctx.trap_divzero = True
>>> mpc(0)**-1
Traceback (most recent call last):
File "<python-input-4>", line 1, in <module>
mpc(0)**-1
~~~~~~^^~~
gmpy2.DivisionByZeroError: division by zero
That close to my results:
I would appreciate your review on that pr. benchmark scriptimport pyperf
z = complex(3.140625, 1.0)
runner = pyperf.Runner()
for n in (-5, -4, -3, -2, -1, 1, 2, 3, 4, 5):
runner.bench_func(f"pow(z, {n})", pow, z, n) |
|
I want to make a few quick notes before bedtime.
That's not what I see when |
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>


Comments welcome!
See also: https://discuss.python.org/t/out-of-range-error-when-building-python-3-14-7-with-gcc-16-2-0/108539