Why is a signed byte's lowest value -128? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is a signed byte's lowest value -128?

Howdy, I googled online and searched on here for the answer but no dice, I do apologize if this has been asked before or that I didn't use the proper search terms. I understand why the largest value is 127, but I'd assumed that the lowest value would be -127. 01111111 is 127 11111111 is -128? I believe that the 8th bit is to indicate weather the value is a positive or a negative, and the maximum value for 7 bits would be 127. So why is it 128 when it's negative?

26th Feb 2020, 3:05 AM
Odyel
Odyel - avatar
3 Answers
0
Avinesh If 0 | 111 = 7 Why is 1 | 111 = -8? The only difference I can see is the 4th bit making it negative. 3 bits can only represent up to 7. Can you explain in layman's terms why it's -8? And yes i did read the thread.
26th Feb 2020, 4:00 AM
Odyel
Odyel - avatar
0
Oh, so it's using two's compliment. I was looking at it as the signed magnitude representation (SMR). Thanks for clearing that up!
26th Feb 2020, 4:12 AM
Odyel
Odyel - avatar