Converting fractional 2's complement value to decimal

2k Views Asked by At

I can't seem to find a relevant answer after searching yesterday, so I'm hoping someone here will be able to clear this up for me.

If I have the binary value 11011.010, how would I go about converting it from its current 2's complement form to decimal?

As I currently understand it, to convert from 2's complement to decimal you must complement each bit and add +1 to the result. However, I'm a bit unclear regarding the final step of adding +1.

Am I to add +1 to the least significant bit (including the fractional bits), or only to the least significant integer bit?

For example, would the conversation go like this?

(A)   11011.010  -->  00100.101  -->  00100.110  =  (-)4.75 D

Or like this?

(B)   11011.010  -->  00100.101  -->  00101.101  =  (-)5.625 D
1

There are 1 best solutions below

1
On

Option (A) is correct

https://www.tutorialspoint.com/2-s-complement-fractions

The most significant bit of 11011.010 is 1, so this is a negative number. Now, we need to complement all digits, to obtain 00100.101 and then sum 1 to get 00100.110

The rationale goes as follows: if we represent number 0

as 10 or 00

this would be both ambiguous and wasteful. Therefore, we represent 0 as 00 and leave 10 to represent a negative number, namely 01+1 in binary which equals -2 in decimal. Otherwise, with two digits we would only be able to represent

0, 1 and -1

The exact same idea is applicable to rational numbers: adding 1 to the least significant bit is just a way to represent one additional number and have a 1-1 correspondence between decimal numbers and their binary representation