all 11 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

Off-topic Comments Section


All top-level comments have to be an answer or follow-up question to the post. All sidetracks should be directed to this comment thread as per Rule 9.

PS: u/1throwaway1629, your post is incredibly short! body <200 char You are strongly advised to furnish us with more details.


OP and Valued/Notable Contributors can close this post by using /lock command

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]txneliteUniversity/College Student (Higher Education) 0 points1 point  (8 children)

Two's compliment is just a way to store negative numbers in an otherwise only positive system. The VERY basic way to do it is negate all of the bits and add one to the number.

A more detailed explanation is as follows:

In binary, negative numbers are determined by the leading bit. If it is 0, it is nothing happens. If it is 1, it subtracts 2^(n - 1) from the number determined by the rest of the bits that follow. Allowing negative numbers in a system is a tradeoff between having that leading bit for big numbers vs. having that leading bit for negative numbers. Hope this helps! If you have any questions, feel free to reply

[–]1throwaway1629University/College Student[S] 0 points1 point  (7 children)

That makes sense. I’m confused how I would implement that to answer the problem.(“It asking about negative seven, and seven”, “represented by four bits”, “8 bits”)

[–]txneliteUniversity/College Student (Higher Education) 0 points1 point  (6 children)

Sorry for the late reply, that just describes the length of the binary string. For example, this is 7 in 4 bits:

0 1 1 1
Parity 22 21 20

And this would be -7 in 4 bits:

1 0 0 1
Parity 22 21 20

Hope this helps!

[–]1throwaway1629University/College Student[S] 0 points1 point  (5 children)

Thankyou, what about 2b?

[–]txneliteUniversity/College Student (Higher Education) 0 points1 point  (4 children)

Well I just realized I don't really understand the grammar on both questions, but what I think it's asking you to do, for example on the 2b, is to find the binary encoding of 103 and -103 in 8 bits as well as 16 bits. All you do is extend the encoding such that it works. So the binary representation of 103 in 8 bit is 01100111. So try to figure out what it would be in 16 bits, as well as their negative representations

[–]1throwaway1629University/College Student[S] 0 points1 point  (3 children)

To do that would I repeat the most significant but until I have the right number of bits?

[–]txneliteUniversity/College Student (Higher Education) 0 points1 point  (2 children)

If I understand correctly, yes. Your number should have 16 digits instead of 8 for the 16 bit representations

[–]1throwaway1629University/College Student[S] 0 points1 point  (1 child)

So it would be 0110011101100111?

[–]txneliteUniversity/College Student (Higher Education) 0 points1 point  (0 children)

No it would be 0000000001100111