[Numpy-discussion] Re: Extend ldexp to handle complex inputs

2024-09-27 Thread Stefano Miccoli via NumPy-Discussion
‘np.ldexp’ exists mainly for compatibility with the C/C++ functions ldexp, ldexpf, ldexpl, which are defined for float/double/long double. Quoting the C refs: > On binary systems (where FLT_RADIX is 2), ldexp is equivalent to scalbn. > The function ldexp ("load exponent"), together with its dual,

[Numpy-discussion] Re: Extend ldexp to handle complex inputs

2024-09-25 Thread Marten van Kerkwijk
Probably good to think first what the inverse function, np.frexp, should do for complex numbers. I guess the choices are: 1. Remove the largest exponent of real/imaginary, and give a complex mantissa, in which only one of the real or imaginary components is guaranteed to have its absolute va