Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 258907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:13:11+00:00 2026-05-11T22:13:11+00:00

I’m in a computer systems course and have been struggling , in part, with

  • 0

I’m in a computer systems course and have been struggling, in part, with two’s complement. I want to understand it, but everything I’ve read hasn’t brought the picture together for me. I’ve read the Wikipedia article and various other articles, including my text book.

What is two’s complement, how can we use it and how can it affect numbers during operations like casts (from signed to unsigned and vice versa), bit-wise operations and bit-shift operations?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:13:11+00:00Added an answer on May 11, 2026 at 10:13 pm

    Two’s complement is a clever way of storing integers so that common math problems are very simple to implement.

    To understand, you have to think of the numbers in binary.

    It basically says,

    • for zero, use all 0’s.
    • for positive integers, start counting up, with a maximum of 2(number of bits – 1)-1.
    • for negative integers, do exactly the same thing, but switch the role of 0’s and 1’s and count down (so instead of starting with 0000, start with 1111 – that’s the "complement" part).

    Let’s try it with a mini-byte of 4 bits (we’ll call it a nibble – 1/2 a byte).

    • 0000 – zero
    • 0001 – one
    • 0010 – two
    • 0011 – three
    • 0100 to 0111 – four to seven

    That’s as far as we can go in positives. 23-1 = 7.

    For negatives:

    • 1111 – negative one
    • 1110 – negative two
    • 1101 – negative three
    • 1100 to 1000 – negative four to negative eight

    Note that you get one extra value for negatives (1000 = -8) that you don’t for positives. This is because 0000 is used for zero. This can be considered as Number Line of computers.

    Distinguishing between positive and negative numbers

    Doing this, the first bit gets the role of the "sign" bit, as it can be used to distinguish between nonnegative and negative decimal values. If the most significant bit is 1, then the binary can be said to be negative, where as if the most significant bit (the leftmost) is 0, you can say the decimal value is nonnegative.

    "Sign-magnitude" negative numbers just have the sign bit flipped of their positive counterparts, but this approach has to deal with interpreting 1000 (one 1 followed by all 0s) as "negative zero" which is confusing.

    "Ones’ complement" negative numbers are just the bit-complement of their positive counterparts, which also leads to a confusing "negative zero" with 1111 (all ones).

    You will likely not have to deal with Ones’ Complement or Sign-Magnitude integer representations unless you are working very close to the hardware.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to clean up various Word 'smart' characters in user input, including but
i want to parse a xhtml file and display in UITableView. what is the
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.