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 3757886
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:04:34+00:00 2026-05-19T10:04:34+00:00

Let’s say I want to convert -128 into binary. From what I understand, I

  • 0

Let’s say I want to convert “-128” into binary.

From what I understand, I get the binary representation of “128”, invert the bits and then add 1.

So 128 = 10000000

So the “inverse” is 01111111

So and “01111111” + “1” = “10000000” which is “-0” isn’t it?

My textbook makes this seem so easy but I can’t figure out what I’m doing wrong. Thanks for the help.

  • 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-19T10:04:35+00:00Added an answer on May 19, 2026 at 10:04 am

    No, that’s definitely -128 (in two’s complement anyway, which is what you’re talking about given your description of negating numbers). It’s only -0 for the sign/magnitude representation of negative numbers.

    See this answer for details on the two representations plus the third one that C allows, one’s complement, but I’ll copy a snippet from there to keep this answer as self-contained as possible.


    To get the negative representation for a positive number, you:

    • invert all bits then add one for two’s complement.
    • invert all bits for one’s complement.
    • invert just the sign bit for sign/magnitude.

    You can see this in the table below:

    number | twos complement     | ones complement     | sign/magnitude
    =======|=====================|=====================|====================
         5 | 0000 0000 0000 0101 | 0000 0000 0000 0101 | 0000 0000 0000 0101
        -5 | 1111 1111 1111 1011 | 1111 1111 1111 1010 | 1000 0000 0000 0101
    

    You should be aware that there is no 128 in 8-bit two’s complement numbers, the largest value is 127.

    Where the numbers pass the midpoint is where the “clever” stuff happens:

    00000000 ->    0
    00000001 ->    1
    : :
    01111110 ->  126
    01111111 ->  127
    10000000 -> -128
    10000001 -> -127
    : :
    11111110 ->   -2
    11111111 ->   -1
    

    because adding the bit pattern of (for example) 100 and -1 with an 8-bit wrap-around will auto-magically give you 99:

    100+  0 0110 0100
      1-  0 1111 1111
          ===========
          1 0110 0011  99+ (without that leading 1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a drive such as C:\ , and I want to
Let's say I have two files.. I want to compare them side-by-side and see
Let's say you create a wizard in an HTML form. One button goes back,
Let's say I'm building a data access layer for an application. Typically I have
Let's say you have a class called Customer, which contains the following fields: UserName
Let's say we have a simple function defined in a pseudo language. List<Numbers> SortNumbers(List<Numbers>
Let's say I'm writing a PHP (>= 5.0) class that's meant to be a
Let's say that we have an ARGB color: Color argb = Color.FromARGB(127, 69, 12,
I have a French site that I want to parse, but am running into
Let's say that I have an arbitrary string like `A man + a plan

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.