How to Calculate the Decimal Value of Signed Binary Numbers

Now that we have learned about signed number binary representation, let’s discuss how to find out the decimal value of a signed binary number if the format of the representation is known.

Sign-Magnitude Form:

  • Only the magnitude bits are considered for finding the decimal value, the sign bit will decide the sign.

Example:

An 8-bit binary number represented in sign-magnitude form is 10010101. Find the decimal value of the number.

Answer: The given number is, 10010101

The leftmost bit is ‘1’, which is the sign bit. This indicates that the number is a negative number.

The rest of the bits other than the sign bit (0010101) are magnitude bits. Now, we need to calculate the magnitude of the number in decimal.

The magnitude of 0010101 in decimal is 21.

So, the decimal value of 10010101 (sign-magnitude form)is -21.

1’s Complement Form:

  • Consider the MSB (nth bit) as the sign bit and multiply -2n-1 to the nth bit while finding the decimal value. The remaining bits will be multiplied with +2k, where ‘k’ is the respective “weight” of the bit.
  • If the result is a negative number, then add 1 to the result.

Example:

Find the decimal value of (i) 00010111, and (ii) 11101000. Both the numbers are represented in 1’s complement form.

Answer: Both the given binary numbers are 8-bit numbers. In such cases, we need to multiply -27 (-128) with the 8th bit of the numbers to get the decimal value.

(i) Since the MSB is 0, the value of the given binary number is positive.

Decimal of 1's Complement (+ve number)

Decimal of 1’s Complement (+ve number)

(ii) Since the MSB is 1, the value of the given binary number is negative.

Decimal of 1’s Complement (-ve number)

2’s Complement Form:

  • Consider the MSB (nth bit) as the sign bit and multiply -2n-1 to the nth bit while finding the decimal value. The remaining bits will be multiplied with +2k, where ‘k’ is the respective “weight” of the bit.

Example:

Find the decimal value of (i) 00010111, and (ii) 11101000. Both the numbers are represented in 2’s complement form.

Answer: Both the given binary numbers are 8-bit numbers. In such cases, we need to multiply -27 (-128) with the 8th bit of the numbers to get the decimal value.

(i) Since the MSB is 0, the value of the given binary number is positive.

Decimal of 2’s Complement (+ve number)

(ii) Since the MSB is 1, the value of the given binary number is negative.

Decimal of 2’s Complement (-ve number)

From the above examples, you can observe that the representation of a positive number is the same for both 1’s complement and 2′ complement. Check it for +23. Try finding out the sign-magnitude form of +23 in binary and write your observation in the comment.

For detailed explanations, watch the following video.

Leave a Reply

Your email address will not be published. Required fields are marked *