Open skirpichev opened 1 month ago
This is a good idea. I've started work on it.
Maybe it's wise to wait for a fate of above CPython PR. Note that special rules for real arguments can't save all identities, e.g. for atan: https://github.com/python/cpython/pull/124829#issuecomment-2387555557
Proper solution would be using also C99 Annex G imaginary-like type. But this one will be not closed under arithmetic operations (i.e. 1j*1j->-1.0
). I'm thinking on a different approach (which might work for mpc
too): https://github.com/python/cpython/pull/124829#discussion_r1788881051
The MPC has special routines to do arithmetic with operands of different types (i.e. mpc_t and mpfr_t), but gmpy2 don't use this stuff (for example, mpc_mul_fr()).
I think we should. Such arithmetic fix some analytical identities, that are broken in gmpy2 now. Consider asinh:
Also, I would expect some performance boost.
See also https://github.com/python/cpython/pull/124829