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 #54

Closed RuotingDingKolmostar closed 2 years ago

RuotingDingKolmostar 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

ruoting0103 commented 2 years ago

sorry very much that I raised the issue with the wrong account , I raised another one with correct account alreay https://github.com/francof2a/fxpmath/issues/55 , could you help me to delete this issue https://github.com/francof2a/fxpmath/issues/54, thanks a lot

francof2a commented 2 years ago

No problem! Closing this issue because it's duplicated in #55 .