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

  • SEARCH
  • Home
  • 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 8696963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:23:51+00:00 2026-06-13T01:23:51+00:00

I was doing an excercise when I realized: a-2 = a-1-1 = a +

  • 0

I was doing an excercise when I realized:

a-2 = a-1-1 = a + (2'complement of 1) - 1
    = a + (1's complement of 1 + 1) - 1
    = a + 1's complement of 1
    = a + 0
    = a

So ultimately

a-2 = a

What did I do wrong here?

  • 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-06-13T01:23:52+00:00Added an answer on June 13, 2026 at 1:23 am

    Where you got it wrong is that (2'complement of 1) is not (1's complement of 1 + 1).

    You need to be consistent in the way that you treat the operands, either they express two’s complement values or one complement’s values, it is not ok to mix both.

    It is merely a convention, very much akin to the difference between signed and unsigned scalar types in various programming languages. You cannot mix signed and unsigned scalars in the same arithmetic operation and expect the result to be correct.

    Specifically: (assuming 8 bits integer size, the argument is the same only the range of values allowed in either 1’s comp. or 2’s comp. differ).
    In one’s complement convention, 1's complement of 1 is 11111110 it represents the value 254 which is a value that cannot be represented in two’s complement convention (with 8 bit integers); the range of values you can have in two’s complement is -128 to +127.

    In your derivation your are therefore writing an operation that is invalid, let’s rewrite it using decimal values equivalencies:

    a-2 = a-1-1            // OK, we start in 2's complement convention
        = a + (-1) - 1     // OK, we're still in 2's complement convention
        = a + (+255) - 1   // OOPS: we're switching our interpretation of the operand
                           // in parenthesis, we now understand it to be in 1's comp.
                           // but... wait!  255 is not in the range of the 2's comp.
                           // convention we started with.  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am learning Java, now working with arrays. I am doing an excercise where
noob here. I'm doing an exercise from a book and the compiler reports no
I am doing an excercise in the book Java how to program. I am
noob here. Having a doubt while doing an exercise from a book. The doubt
I was doing an exercise on F# Wiki Book on List (scroll to the
I am doing this small exercise. declare @No decimal(38,5); set @No=12345678910111213.14151; select @No*1000/1000,@No/1000*1000,@No; Results
Today I was doing the thread ring exercise from the Programming Erlang book and
Hey all. I'm doing a linked list exercise that involves dynamic memory allocation, pointers,
Okay, so I'm doing a little blowfish implementation in PHP as a programming exercise
I was doing the exercises from YAHT's Recursive Datatype section, and found writing the

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.