In the bitwise compliment operator there is confusion. Please help if you can.
For the 2’s complement, if we take 8 bits for a binary representation,
in the case of decimal 200, binary is 11001000
2’s complement is also 11001000
In the procedure to calculate mentioned in the link https://www.rit.edu/academicsuccesscenter/sites/rit.edu.academicsuccesscenter/files/documents/math-handouts/DM3_TwosComplement_BP_9_22_14.pdf, it should be 00111000
The confusion must be because of the 8th bit being a 1.
12 Replies
⌛
This post has been reserved for your question.
Hey @theash2473! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
Decimal 200 can't exist in a 2's complement 8 bit format
Maximum is 127
assembly language is complex. I'll recommend you use an online assembly language calculator to verify / learn / check your work.
there is one rule to find out the 2's complement, you have an OR with one , you can go and check out for Operating System Books you will find that
OR it with one? I thought it was bitwise negating it and then adding 1
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
Can you suggest one?
Why do they not mention it int he articles.
the one with bitwise negating the number and adding 1 should work
(~number)+1
same goes for converting it back to positive
yes
Regardless of 2's complement, with 8 bits there is a limit to the numbers you can represent. You can't represent 400 for example.
Someone who would be interested in 2's complement in the way described in the article, is supposed to already know enough about binary in computers, and notably to know that there are limits.
It seems nonmandatory to explain that some values rather away from zero, can't be represented with an 8 bit format that handles negatives.
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.