So I'm doing CS and the lecturer wrote out a new binary question that I can't wrap my head around.
Basically, how do you subtract two negative numbers if they are in binary?
Specifically how to do it using Two's Constant which was just introduced.
For example: -2 - -7 = 5
Or: 1110 - 1001
I don't understand how you use those bits to get the correct answer, Ie 5.
Can anyone help please?
If you have
1110 -2
- 1001 -7
------
0101 5
and this is the same as
1110 -2
+ 0111 7
------
0101 5
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.