Results 1 to 6 of 6

Thread: [RESOLVED] What system does a computer use...

  1. #1

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Resolved [RESOLVED] What system does a computer use...

    Hi,

    I'm not sure if this is the correct forum to post this in but the question is part of a maths assignment. The question is: What system does a computer use in order to distinguish between positive and negative numbers when it stores them in memory? (How is the number of bits changed from those used to express the namber usually?)

    I don't understand to what the question is referring to, I am thinking the system is binary I can't remember reading about how it distinguishes between positive and negative numbers.

    Thanks


    Nightwalker
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  2. #2
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431

    Re: What system does a computer use...

    It's almost certainly referring to two's complement. If the question is as written, though, it's ambiguous because there are a lot of different schemes to encode both positive and negative numbers in binary for use by computers. The advantage of two's complement is that it uses the same hardware for adding and subtracting, and it has reasonable overflow values. Oh, it also doesn't have +0 and -0 as separate binary strings, which the other encoding system I'm aware of (stick a 1 out front for negative, a 0 for positive) has.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  3. #3

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: What system does a computer use...

    Yeah, the question is a bit ambiguous! I tried looking in the chapters of the textbook we were give for the answer but I couldn't find anything mentioning negative binary numbers as suggested above. I will see if my class mates had any luck understanding the problem and ask them how they found the solution failing that I will have to tracking down my lecturer and ask him about the question.
    Last edited by Nightwalker83; Feb 16th, 2010 at 03:09 AM. Reason: Fixed Spelling!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  4. #4
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431

    Re: What system does a computer use...

    I wouldn't ignore two's complement. From the article, "this system is the most common method of representing signed integers on computers." The answer to the question above, if it's going from unsigned integer representations to signed integer representations using two's complement is that the number of bits increases by 1. That is, to express 255, you use 1111 1111 (unsigned) or 0 1111 1111 (two's complement signed), meaning you had to add a bit.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  5. #5

    Thread Starter
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: What system does a computer use...

    Thanks for the help! I asked a class mate what he thought the problem was asking and this was his solution:

    A sign bit

    Example in a 32 bit integer only 31 bits are used to store the value. The other one is used to store the negative/positive value.
    Last edited by Nightwalker83; Feb 16th, 2010 at 05:16 AM. Reason: fixed spelling
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  6. #6
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: [RESOLVED] What system does a computer use...

    In a nutshell, the high bit of any register (when regarded as a signed integral value) indicates the sign. But it's not that simple...

    Using Intel's IA-32 architecture (basically Pentium family and a few notable others) if you expand a negative signed 16-bit value into a signed 32-but value, all of the high word's bits will be set high...

    16-bit negative value (decimal -100)
    1111111110011100
    becomes...
    11111111111111111111111110011100

    This is a widening conversion so the CPU has to preserve the top bit by repeating it until the new 32-bit value is properly filled.

    Of course the CPU has no particular interest in whether a value is signed or unsigned, it all depends on what operators you use to manipulate the data!

    Assembly language is extremely rewarding if you can spend the time to learn a little more about it. I highly recommend it.
    I don't live here any more.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width