MHB Convert Decimals to Signed 12-Bit Numbers

  • Thread starter Thread starter shamieh
  • Start date Start date
  • Tags Tags
    Numbers
Click For Summary
SUMMARY

This discussion focuses on converting decimal numbers into signed 12-bit representations using sign and magnitude, 1's complement, and 2's complement methods. The decimal numbers analyzed include 73, 1906, -95, and -1630. The conversions for 73 yield identical binary representations across all three methods, while 1906's conversion reveals a misunderstanding of binary representation, specifically regarding the powers of 2 that sum to the decimal value. The correct binary representation for 1906 is derived through iterative subtraction of the largest fitting powers of 2.

PREREQUISITES
  • Understanding of binary number systems
  • Knowledge of signed number representations
  • Familiarity with 1's and 2's complement methods
  • Basic arithmetic operations involving powers of 2
NEXT STEPS
  • Research the process of converting decimal numbers to binary
  • Study the differences between sign and magnitude, 1's complement, and 2's complement representations
  • Learn about overflow and underflow in binary arithmetic
  • Explore practical applications of signed binary numbers in computer systems
USEFUL FOR

Students and professionals in computer science, electrical engineering, and anyone interested in understanding binary number representation and conversions.

shamieh
Messages
538
Reaction score
0
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 $$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? $$2^{11} + 2^{10} + 2^9$$ does NOT equal 1906!
 
Technology news on Phys.org
shamieh said:
1906 sign and mag: 011101110010 , 1s comp = 011101110010 2s comp = 011101110010

but how? $$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:
$$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.
 
shamieh said:
1906 sign and mag: 011101110010 , 1s comp = 011101110010 2s comp = 011101110010

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

Similar threads

Replies
5
Views
2K
  • · Replies 17 ·
Replies
17
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 12 ·
Replies
12
Views
4K
Replies
1
Views
2K
Replies
3
Views
12K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
2
Views
2K
Replies
1
Views
3K