English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I know the range, but can someone please explain it to me with a little detail?

2007-09-25 04:49:05 · 2 answers · asked by James W 2 in Computers & Internet Programming & Design

2 answers

You have seven bits plus a sign-bit available to express those 256 numbers as signed integers.

Positive numbers would be 0 to +127, which are 128 values with the sign bit set to zero as a "positive indicator."

Negative ones are 0 to -127, which are 128 values with the sign bit set to one as a "negative-indicator."

2007-09-25 04:59:57 · answer #1 · answered by Rich Z 7 · 0 0

It's been a while, so I might be a bit fuzzy, but:

You are talking about a signed integer where the first bit indicates if it is positive or negative (0=positive, 1=negative). If it is positive, you use the rest of the 7 bits like you would normally count in binary, if it is negative I believe you subtract 255 or (2^n-1) from the value.

So,

0111 1111 = 127
1111 1111 = 127-255= -128

2007-09-25 05:31:51 · answer #2 · answered by Haley 5 · 0 0

fedest.com, questions and answers