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
JavaBot
JavaBot2mo ago
This post has been reserved for your question.
Hey @theash2473! Please use /close or the Close 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.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Kyo-chan
Kyo-chan2mo ago
Decimal 200 can't exist in a 2's complement 8 bit format Maximum is 127
Edmon
Edmon2mo ago
assembly language is complex. I'll recommend you use an online assembly language calculator to verify / learn / check your work.
harshu4614
harshu46142mo ago
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
dan1st
dan1st2mo ago
OR it with one? I thought it was bitwise negating it and then adding 1
JavaBot
JavaBot2mo ago
💤 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.
theash2473
theash2473OP2mo ago
Can you suggest one? Why do they not mention it int he articles.
dan1st
dan1st2mo ago
the one with bitwise negating the number and adding 1 should work (~number)+1
noComment | Kez
noComment | Kez2mo ago
same goes for converting it back to positive
dan1st
dan1st2mo ago
yes
Kyo-chan
Kyo-chan2mo ago
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.
JavaBot
JavaBot2mo ago
💤 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.
Want results from more Discord servers?
Add your server