You are given a 16-bit binary integer X= (1110 0100 0111 1010)2 . Convert X to decimal if:

a. X is unsigned
b. X is in sign-magnitude notation
c. X is in one’s complement notation
d. X is in two’s complement notation

Respuesta :

Step-by-step explanation:

a). The decimal numbers is equal to the sum of binary numbers [tex]$(b_n)$[/tex]  times their powers of   [tex]$ 2(2^n) .$[/tex]

That is,

[tex]$ b_n \times 2^n + b_{n-1} 2^{n-1}+ ..... + b_02^0 $[/tex]

[tex]$\therefore (1110 \ \ 0100 \ \ 0111 \ \ 1010)_2 $[/tex]

=  [tex]$ (0 \times 2^0) + (1 \times 2^1) + (0 \times 2^2) + (1 \times 2^3) + (1 \times 2^4) + (1 \times 2^5) + (1 \times 2^6) + ( 0 \times 2^7) + (0 \times 2^8) + (0 \times 2^9) + (1 \times 2^{10} ) $[/tex][tex]$ + (0 \times 2^{11}) + (0 \times 2^{12}) + (1 \times 2^{13}) + (1 \times 2^{14})+ (1 \times 2^{15})$[/tex]

= 58490

b).

The left most bit of the number represents the sign of the number. If bit = 1, the number is negative else if the bit is 0, the number is positive.

All the remaining bits (i.e all the bits except the leftmost bit) represent the magnitude of the number.

  Now, X = 1110 0100 0111 1010

  left most bit = 1 => number is negative

  remaining bits Y = 110 0100 0111 1010

  converting Y to decimal => Y = 25722

c).

Check the leftmost bit(lmb) of the number

if leftmost bit is 0 => convert do the binary to decimal conversion

if leftmost bit is 1, follow the following steps

  1. Flip the bits (convert the 0's into 1's and the vice versa)

  2. convert the new number from binary to decimal.

  3. Add a negative sign / multiply by -1

 Now, X = 1110 0100 0111 1010

left most bit = 1;

flipping the bits => Y = 0001 1011 1000 0101

converting Y into decimal => Y = 7045

multiplying Y with -1 => Y = -7045

Therefore, one's complement of X to decimal is -7045

Thus, X = -25722 in decimal.

d).

Check the leftmost bit(lmb) of the number

  if leftmost bit is 0 => convert do the binary to decimal conversion

  if leftmost bit is 1, follow the following steps

  1. Flip the bits (convert the 0's into 1's and the vice versa)

  2. convert the new number from binary to decimal.

  3. Add 1 to the converted number

  4. Add a negative sign / multiply by -1

Now, X = 1110 0100 0111 1010

left most bit = 1;

flipping the bits => Y = 0001 1011 1000 0101

converting Y into decimal => Y = 7045

Adding 1 to Y => Y = 7046

multiplying Y with -1 => Y = -7046

Thus, two's complement of X to decimal is -7046

Q&A Education