francof2a / fxpmath

A python library for fractional fixed-point (base 2) arithmetic and binary manipulation with Numpy compatibility.
MIT License
183 stars 21 forks source link

bitwise operation for complex data is confusing #55

Open ruoting0103 opened 2 years ago

ruoting0103 commented 2 years ago

bitwise operation of a complex number only applies to real component and yields a non-complex integer, take x = Fxp(0b11+0b11*1j, dtype = 'fxp-u2/0-complex') as an example , x&0b01 outputs fxp-u2/0((1+0j)) the possible expected behaviors should be :

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [51], in <module>
      1 data =0b11+0b11*1j
----> 2 data&0b11

TypeError: unsupported operand type(s) for &: 'complex' and 'int'

thanks