1

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?

  • Add a bit, such that no information is lost :} The number of bits required to represent numbers [0..d) in decimal is `log2(d)`. – user2864740 Sep 13 '16 at 02:24

1 Answers1

2

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.

programmerj
  • 1,634
  • 18
  • 29