Turn on thread page Beta

What's the difference between sign-magnitude and 2's complement? watch

    • Thread Starter
    Offline

    13
    ReputationRep:
    I understand that 2's complement solves the issues of sign magnitude when adding/subtracting numbers, and has one representation for 0. I also know it is an easier way to deal with negative numbers, but I still don't understand the difference in theory.

    They both use the most significant bit as a sign representation, but how does 2's complement differ and resolve the issues?
    Offline

    3
    ReputationRep:
    Sign-magnitude has the first bit saying whether or not it's positive or negative (the sign) and the rest of the bits saying the number itself (the magnitude). This obviously means you would have a +0 and a -0

    While twos complement simply represents the number normally if it's positive (same as sign magnitude), but if it's negative, it minuses 1 and then bitwise inverts it. For example, with only 3 bits, DEC -3 is represented as 101. Since you start with 3 (011), you minus one (010) and then invert it (101). The key point here is the fact that you minus one. This means that BIN 100 represents BIN - 011 + 1 = = - 100 = DEC -4. The fact that it minuses one means that you are using that extra 0 as an actual number (the highest possible number) rather than just another 0.
 
 
 
The home of Results and Clearing

1,257

people online now

1,567,000

students helped last year

University open days

  1. University of Buckingham
    Postgraduate Open Evening Postgraduate
    Thu, 23 Aug '18
  2. University of Glasgow
    All Subjects Undergraduate
    Tue, 28 Aug '18
  3. University of Aberdeen
    Undergraduate Open Day Undergraduate
    Tue, 28 Aug '18
Poll
How are you feeling about GCSE results day?

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.