-3

I need to know how to solve this problem please

Represent the following decimal numbers in binary using 8-bit signed magnitude, one’s complement, and two’s complement:

  1. 88
  2. -76

My solution is :

 88 = 01011000 8 bit sm
      10100111 1s complement
      10101000 2s complement

-76 = Not sure about this one
Bill Lynch
  • 80,138
  • 16
  • 128
  • 173
Ali
  • 1
  • 1
  • 2

2 Answers2

1

In 8 bit signed magnitude, the MSB denotes the sign of the number,whether positive or negative.

88 = 01011000

     ^(MSB) this is signed bit,0 for positive.

In Decimal in order to get -76, we subtract 76 from the number of combinations (256), which gives, 256 - 76 = 180.

-76 = 10110100

      ^(MSB) this is signed bit, 1 for negative.

For one's complement representation, simply reverse the bits,i.e., change 0 to 1 and 1 to 0.

Therefore, 86(one's complement) = 10100111.

And, -76(one's complement) = 01001011.

Also, we obtain two's complement by adding 1 to the binary number representation of the number.

Therefore, 86(two's complement) = 10101000.

And, -76(two's complement) = 01001100.

Am_I_Helpful
  • 18,735
  • 7
  • 49
  • 73
0

This link should help you in solving your problem - it's pretty short and straight-forward: http://www.cs.uwm.edu/classes/cs315/Bacon/Lecture/HTML/ch04s11.html

Short explanation of 8-bit signed magnitude:

Number in your desired format looks like this:
1000 0110, which is equal to -6 in decimal:
1*** **** - means that number HAS sign (which is minus),
*000 0110 - which contains binary representation of number.

When you have a positive number, you simply convert it to it's binary form:
(D) 7 = 0000 0111 (D) 20 = 0001 0100

When you have a negative number (e.g. -7), your highest bit is equal to 1: 1...

and the value is simply converted to binary form:
(D) 7 = 111 = 000 0111

Then you combine it:
(D) -7 = 1000 0111.

Note that in this format you can only save number ranged from -127 to 127 - you have just 7 lower bits left for value whereas 8th bit must be left for a sign.

1s complementary example:

(D) -7 = 1000 0111 in 8-bit signed. When you add a number and it's 1s complementary, you should get: 1111 1111
1000 0111 - your number
0111 1000 + - your number's 1s complementary
^^^^^^^^^
1111 1111

Formally, you can do the following operation:
1111 1111
1000 0111 - - your number
^^^^^^^^^
... <- your number's 1s complementary

2s complementary:

When you calculated 1s complementary, simply add 1 to it: 1000 0111 - your number
0111 1000 - your number's 1s complementary
0111 1001 - your number's 2s complemetary

Try to do this yourself and post your answer - this way you will learn much more.

irchris102
  • 108
  • 10