The Student Room Group

8-bit bianry

How do I convert numbers to signed 8-bit binary?
Will the value be the same, if it was signed or unsigned?

For example, I've got the number 22 as 00010110, but that's in unsigned 8-bit binary, would it be the same for signed 8-bit binary?
'Unsigned can hold a larger positive value, and no negative value. Unsigned uses the leading bit as a part of the value, while the signed version uses the left-most-bit to identify if the number is positive or negative. Signed integers can hold both positive and negative numbers.'

Do you study computing at A-level at all? In my Computing course we learn two ways to give a binary integer a sign; 2's compliment and sign and magnitude. I'm not sure if there are more standard ways (I'm not at uni yet!), but these are two methods I know that are used to represent negative and positive numbers in binary. :smile:

For an 8 bit byte, with 2's compliment...

-22

minus222scompliment.png

For an 8 bit byte, with sign and magnitude...

-22

minus22signandmagnitude.png
(edited 7 years ago)
Original post by Me123456789
How do I convert numbers to signed 8-bit binary?
Will the value be the same, if it was signed or unsigned?

For example, I've got the number 22 as 00010110, but that's in unsigned 8-bit binary, would it be the same for signed 8-bit binary?


That would be the same since it is not negative. If it was a negative number we use the eighth bit as a sign. We set it to 1 for negative and 0 for positive. The number is then written normally. As you can imagine this reduces the number of numbers we can represent since we waste the eighth bit as a sign.
Original post by Someboady
That would be the same since it is not negative. If it was a negative number we use the eighth bit as a sign. We set it to 1 for negative and 0 for positive. The number is then written normally. As you can imagine this reduces the number of numbers we can represent since we waste the eighth bit as a sign.


Thank you :h:
Original post by Me123456789
Thank you :h:


No problem. Absolutely love the Profile picture/avatar btw xD :smile:
Original post by sophiebookley
'Unsigned can hold a larger positive value, and no negative value. Unsigned uses the leading bit as a part of the value, while the signed version uses the left-most-bit to identify if the number is positive or negative. Signed integers can hold both positive and negative numbers.'

Do you study computing at A-level at all? In my Computing course we learn two ways to give a binary integer a sign; 2's compliment and sign and magnitude. I'm not sure if there are more standard ways (I'm not at uni yet!), but these are two methods I know that are used to represent negative and positive numbers in binary. :smile:


Thank you :h::h:

I never did it at A-level, but I'm doing it at university now. :redface:
Original post by Me123456789
Thank you :h::h:

I never did it at A-level, but I'm doing it at university now. :redface:


Oh wow! I hope you're enjoying it, hopefully I'll be in the same position in September! :biggrin:
Original post by sophiebookley
Oh wow! I hope you're enjoying it, hopefully I'll be in the same position in September! :biggrin:


It is quite good actually I did struggle with it though :s-smilie:
Ooh, you're doing cs? Where are you going?

Original post by Someboady
No problem. Absolutely love the Profile picture/avatar btw xD :smile:
]

:u:

I don't know if you do this in your A-level but do any of you know how to evaluate the following expression
R2C = M2C D2C
Original post by Me123456789
It is quite good actually I did struggle with it though :s-smilie:
Ooh, you're doing cs? Where are you going?

]

:u:

I don't know if you do this in your A-level but do any of you know how to evaluate the following expression
R2C = M2C D2C


Afraid not, what topic is this?
Original post by Someboady
Afraid not, what topic is this?


I got it now :biggrin:

It was data representation, two's complement
Original post by Me123456789
I got it now :biggrin:

It was data representation, two's complement


o.0 we do two's complement but I've never seen R2C and all that :/ ? I've only seen it in relation to Binary?
Original post by Someboady
o.0 we do two's complement but I've never seen R2C and all that :/ ? I've only seen it in relation to Binary?


Yeah it's still about the 8-bit binary stuff but I had to use two's complement
:dontknow: If that makes sense...
Original post by Me123456789
Yeah it's still about the 8-bit binary stuff but I had to use two's complement
:dontknow: If that makes sense...


o.0
So what exactly does this mean?
R2C = M2C D2C
Sorry I'm very curious XD

Quick Reply

Latest