subtr
Community Member
Offline
Analog Enthusiast
Posts: 72
India
|
Hi Andrew,
Thank you for the links. But my question was not exactly what is two's complement. But as to why it helps me in underflow caused by my DSP operation. Isn't a negative number = underflow at zero? The same underflow will happen in 2's complement as well for the same operation at the most negative number.
In fact after giving a good thought, I have found that an 1 extra MSB + 2's complement is what would actually help. My 8bit data could be operated upon and result in an overflow requiring 9th bit which can be saved by using an additional bit. But bottom side for 9bit and 8bit end at zero which means underflow on the zero side cannot be take care of by the current 9bit system. But if I had a 2's complement 9bit system, it could take care of underflow. I have a picture which I used to visualize the comparisons.
Pure Binary:
0 <------------8bit--------------> Max 0 <---------------------------9bit-------------------------------> Max
Underflow not taken care in the DSP because this 9bit representation can't cannot represent -ve numbers/underflow of 8bit.
2's Complement Representation :
-Max <----------------------------9bit range------------------------------>Max -Max<--------------8bit range----------------->Max
Both sides overflow/underflow taken care by this 9bit system due to DSP. This is the case where overflow/underflow in 9bit does not occur. If that occurs due to addition of more than 4 8-bit numbers,a tenth bit would be required or floating point. In case you see any logical error in this I would like you to correct me because I don't have any document/link reference for this.
My conclusion from the above idea is : 1) 1 extra bit helps in overflow representation. 2) Just 2's complement without extra bit is as good as binary in terms of overflow and underflow as no range extension. 3) 2's complement with an extra bit helps both in underflow and overflow.
|