I saw online that if you want to convert a binary number to a negative binary number, you add 1.However, I don't understand why you do that.In a forum I saw someone explaining the following:
A little rule that I use when I need to represent negative numbers in binary is ~i = -i-1. That is, the bitwise inversion of "i" is equivalent to negative "i" less one. In your example, you're looking for the binary representation of -192. Since -192 = -191-1, the following statement is true: ~191 = -192.
Unfortunately, I don't understand this explanation.I went on further to understand the bit wise inversion of binary and I did understand that: it's only changing 1 into 0 and o into 1. Then I saw the following explanation from Microsoft:
~5 == 11111111 11111111 11111111 11111010 == -6 in decimal.
How do you really get -6 from ~5?How that gives you negative -6. Isn't 6 is 110?And if you add 1 to make it negative, shouldn't it be 111?Can someone please explain?