Is two's complement notation of a positive number the same number?

yesraaj picture yesraaj · Apr 27, 2009 · Viewed 74.9k times · Source

Is two's complement notation of a positive number is same as its binary representation?

Answer

Rob Pilkington picture Rob Pilkington · Apr 27, 2009

Some of the answers and comments are getting the relationship between a "two's complement notation" and the "two's complement of a number" confused. The question may need to be clarified a bit, but it is clearly asking about "two's complement notation."

Two's complement notation includes both positive and negative numbers. Binary numbers can mean lots of things, so in order to determine what any binary number is supposed to represent, one must first know what notation or encoding is being used. The binary number could be an unsigned integer, two's complement integer, an IEEE floating point number, a string of characters, or something else entirely.

So 7 in two's complement notation is 00000111, just as it is as an unsigned integer. And -7 in two's complement notation is 11111001.

So, yes, positive integers in two's complement notation are represented the same way they are with unsigned integers (assuming it is a valid integer for the number of bits being used).