Reputation: 2865
I am working on converting decimal numbers to 2's Complement binary numbers. I understand the concept;
so I have been trying to convert 92(base 10)
92 -> Hex = 5c
5C == 5 12 -> Binary = 01011100
Inverting = 10100011
+ 1
=10100100
But an online converter I used to check my answer says: 01011100 What did I do wrong? I know that the most-significant bit should be 0, as the number is positive. But other than that, I am confused.
update
Is this because positive numbers do not need to be switched for sign magnitude? Therefore, the number remains the same before and after doing 2's complement?
Meaning, the answer that I obtained is actually the negative interpretation; -92?
Upvotes: 1
Views: 6277
Reputation: 14609
Only invert it and add 1 when you're trying to represent a negative number, positive numbers are represented with normal binary. (You just get less range in the positive numbers).
Upvotes: 3