Sign magnitude/1's Complement/2's Complement

  • Thread starter JWest
  • Start date
  • Tags
    Sign
In summary, sign magnitude, 1's complement, and 2's complement are three different ways to represent negative numbers in binary form. They are used for arithmetic operations on negative numbers in binary form, with 2's complement being the most efficient as it has only one representation for zero and simplifies subtraction. Conversion from sign magnitude to 1's complement or 2's complement is done by flipping bits and adding 1. Overflow can occur in all three representations when the result of an operation cannot be represented. Addition and subtraction in these representations follow specific rules, with 2's complement being the most straightforward.
  • #1
JWest
12
0

Homework Statement



a.) What is the lowest number represented by a 12-bit machine using Sign Magnitude?

b.) What is the largest?

c.) What decimal number does the bit pattern "101001010010" represent?

Homework Equations



For a and b:

Signed integer ranges for N bits (I don't know if this is what I need to use):

Lowest: -[2^(N-1) - 1]

Highest: [2^(N-1) - 1]

The Attempt at a Solution



a.) -[2^(N-1) - 1]
-[2^(12-1) - 1]
-[2^(11) - 1]
-[2048 - 1]
-[2047]

b.) [2^(N-1) - 1]
[2^(12-1) - 1]
[2^(11) - 1]
[2048 - 1]
[2047]

c.) Bit pattern: 101001010010
Signed Magnitude: 101001010010b
= -01001010010b
= -[(2^9) + (2^6) + (2^4) + (2^1)]
= -[512 + 64 + 16 + 2]
= -[594]
= -594d
 
Physics news on Phys.org
  • #2
Looks good.
 

1. What is the difference between sign magnitude, 1's complement, and 2's complement?

Sign magnitude, 1's complement, and 2's complement are three different ways to represent negative numbers in binary form. In sign magnitude, the first bit represents the sign of the number (0 for positive, 1 for negative) and the remaining bits represent the magnitude. In 1's complement, the positive numbers are represented as usual, but the negative numbers are obtained by flipping all the bits of the corresponding positive number. In 2's complement, the positive numbers are represented as usual, but the negative numbers are obtained by flipping all the bits and adding 1 to the least significant bit of the corresponding positive number.

2. Why do we use sign magnitude/1's complement/2's complement to represent negative numbers?

We use these representations to perform arithmetic operations on negative numbers in binary form. Sign magnitude and 1's complement are relatively simple to implement, but they have the disadvantage of having two representations for zero (positive and negative zero). 2's complement, on the other hand, has only one representation for zero and makes subtraction easier to perform as it eliminates the need for a separate subtraction circuit.

3. How do you convert a negative number from sign magnitude to 1's complement or 2's complement?

To convert a negative number from sign magnitude to 1's complement, simply flip all the bits (including the sign bit) of the positive number. To convert to 2's complement, first convert the number to 1's complement and then add 1 to the result.

4. Can you explain the concept of overflow in sign magnitude/1's complement/2's complement?

Overflow occurs when the result of a mathematical operation on two binary numbers cannot be represented in the given number of bits. In sign magnitude, overflow occurs when the result has a larger magnitude than can be represented, while in 1's complement and 2's complement, overflow occurs when the result has a larger magnitude than the maximum positive number that can be represented.

5. How do you perform addition and subtraction using sign magnitude/1's complement/2's complement?

In sign magnitude, addition and subtraction are performed as usual, with the sign bit indicating the sign of the result. In 1's complement, addition is performed by adding the two numbers and taking the 1's complement of the result if there is a carry from the most significant bit. For subtraction, the two numbers are added and the 1's complement of the result is taken if there is no carry from the most significant bit. In 2's complement, addition is performed as usual, but for subtraction, the two numbers are added and 2's complement of the result is taken.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
620
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
950
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
927
  • Engineering and Comp Sci Homework Help
Replies
10
Views
3K
Back
Top