numexpr
numexpr copied to clipboard
Unexpected upcasting of complex64 to complex128
Working on https://github.com/pandas-dev/pandas/issues/21374 I am Coming across unexpected complex128 upcasting.
here is an example of numexpr upcasting complex64 to complex128 when python operation conserves the correct dtype.
>>> compl = 1 + 1j
>>> ne.evaluate('compl + 2').dtype
dtype('complex128')
>>> ne.evaluate('compl + compl').dtype
dtype('complex128')
>>> compl+compl
(2+2j)
>>> type(compl+compl)
<class 'complex'>
>>> type(compl+2)
<class 'complex'>
Originally posted by @mutricyl in https://github.com/pydata/numexpr/issues/155#issuecomment-2147531303