Sorry, I didn't want to start a new thread as this is not DIRECTLY tied to C programming..
I need to understand one’s and two's Complement System Arithmetic.
Here is an example problem:
______________________________________________
Step1: Represent -3 and +5 as 4-bit numbers
So, -3 = 1100 and +5 = 0101
Step2: Add +5 to -3
1100 = -3
+ 0101 = +(+5)
-------------------
0001
+ 1
-------------------
0010 = +2
Carry into MSB is 1 and carry out of MSB is 1. No overflow.
__________________________________________________
The only thing I don't understand is how they got "Carry into MSB is 1 and carry out of MSB is 1"
I think I understand overflow but I am not sure. The way I see it, one way of detecting overflow is if you add two positive numbers and end up with a negative result or you are suppose to end up with a negative result and you end up with a positive result that that is considered overflow. Is that correct?
Thank you in advance for the help.