1 year ago
#212627
hokk
Why is the min value of a value bigger than the max value?
Let's just look at a signed char. A char has 8 bits. The max value is 127 which makes sense to me but why is the min value -128. Let's say if the first number is 1 it's + and 0 is -
1 1 1 1 1 1 1 1
'+' 64 32 16 8 4 2 1 = +127 <- makes sense
0 1 1 1 1 1 1 1
'-' 64 32 16 8 4 2 1 = -127 <- so this should be -127 but why is it -128?
And thats for every signed value: char -128,+127 short -32768,+32767 and so on.
I really hope you understand my question if you have questions just ask.
binary
unsigned
signed
0 Answers
Your Answer