Rachel Dao
Rachel Dao

Reputation: 9

151 as an 8-bit signed binary number

Converting base 10 to base 2 n = 8

A= 49 B= 151

By doing so 49 is 00110001 and -49 would be 11001111.

I am having problems with finding 151 and -151 because after the conversion it is already an 8-bit number. 151 is 10010111, but in signed binary doesn't the farthest left digit indicate whether its negative or positive. 1 is negative and I am trying to get positive 151, but within 8-bits. How would I go about this?

Upvotes: 1

Views: 1141

Answers (1)

programmerj
programmerj

Reputation: 1684

If you only have 8 bits, then your unsigned range is 0 to 255, which makes your signed range -128 to 127. So you cannot express -151 or 151 as a signed number with only 8 bits.

Upvotes: 2

Related Questions