Welcome to our community

Be a part of something great, join today!

Convert the decimal numbers 73, 1906, -95, and -1630 into signed 12 bit numbers in the following...

shamieh

Active member
Sep 13, 2013
539
Convert the decimal numbers 73, 1906, -95, and -1630 into signed 12 bit numbers in the following representations:
a) Sign and magnitude
b) 1's complement
c) 2's complement

So 73 is easy. It's positive so I know it starts with 0. so I know that

73: sign and mag = 000001001001, 1s complement = 000001001001, 2's complement = 000001001001 . We know this because \(\displaystyle 2^6 + 2^3 + 2^0 = 73.\)

BUT let's say I have

1906. I know the first digit will be 0 because it is positive.

So wouldn't I find the sign and magnitude the same way?

1906 sign and mag =what? Apparently it doesn't work the same way?

they are getting this:

1906 sign and mag: 011101110010 , 1s comp = 011101110010 2s comp = 011101110010

but how? \(\displaystyle 2^{11} + 2^{10} + 2^9\) does NOT equal 1906!
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,780
1906 sign and mag: 011101110010 , 1s comp = 011101110010 2s comp = 011101110010

but how? \(\displaystyle 2^{11} + 2^{10} + 2^9\) does NOT equal 1906!
Counting from right to left, the 1's in your number correspond to the powers of 2:
\(\displaystyle 2^{10} + 2^9 + 2^8+ 2^6 + 2^5 + 2^4 + 2^1=1906\)

To convert 1906 to a binary number you would find the largest power of 2 that fits into it, yielding the first '1'.
Then subtract it and repeat.

The largest power of 2 that fits is $2^{10}=1024$.
That leaves $1906 - 1024 = 882$.
Next largest power of 2 that fits is $2^9=512$.
Leaving $882 - 512 = 370$.
And so on.
 

Evgeny.Makarov

Well-known member
MHB Math Scholar
Jan 30, 2012
2,492
1906 sign and mag: 011101110010 , 1s comp = 011101110010 2s comp = 011101110010

but how? \(\displaystyle 2^{11} + 2^{10} + 2^9\) does NOT equal 1906!
How did you come up with \(\displaystyle 2^{11} + 2^{10} + 2^9\) starting from 011101110010?