$$0010\ 0100\ 1001\ 0010\ 0100\ 1001\ 0010\ 0100$$ What decimal number does it represent, assuming it's a two’s complement integer?
Asked
Active
Viewed 374 times
-3
-
Im so confused. I dont understand – Roxas Dec 28 '15 at 13:04
-
I do not either (your question, that is). – Dec 28 '15 at 13:05
1 Answers
0
Convert the two's complement number $0010~0100~ 1001~ 0010~ 0100~ 1001~ 0010~ 0100$ to decimal.
The leftmost bit is a zero, which tells us that it is a positive number. If it were a $1$, it would be a negative number.
To convert a positive two's complement number to decimal number, we simply convert from binary to decimal. If it were a negative two's complement, we invert each of the bits and add $1$.
Since this is a positive number, we simply convert from binary to decimal and this gives:
$$0010~0100~ 1001~ 0010~ 0100~ 1001~ 0010~ 0100 = 613566756_{10}$$
Moo
- 11,311
-
I did check and also used a 32 bit Two's complement to decimal converter and it gave me a different value. :( – Roxas Dec 28 '15 at 13:15
-
-
But wait, on the website you gave it says that when its "1" then we invert and add one , but when it starts with "0" we simply convert it to decimal. the number i gave starts 0, so why did we have to invert each of the bits? – Roxas Dec 28 '15 at 13:27
-
Yes, im sorry if im bothering, but to get the 613566756 , i have to do alot of calculation. – Roxas Dec 28 '15 at 13:56
-
Did you try writing it as a hex number first and then converting that? That should be much easier. – Moo Dec 28 '15 at 13:57
-
I converted the number to hex and got 24924924 , and then to convert it into decimal, i have to get each number and multiply it (16^0,16^1) but when i added the numbers altogether i dont get the 613566756 :( – Roxas Dec 28 '15 at 14:23
-