In an n-bit signed two’s-complement system, the bit pattern is used to represent both positive and negative integers. The key idea is that one bit pattern is reserved for the most negative value, and the remaining patterns are split between negative numbers, zero, and positive numbers.
n bits.2^n possible bit patterns.-2^(n-1)2^(n-1) - 1If the width is 8 bits, the range is:
-2^7 = -1282^7 - 1 = 127
So the range is -128 to 127.Make sure the count of integers in the interval matches 2^n. For n bits, the number of values from -2^(n-1) to 2^(n-1) - 1 is exactly 2^n.
Do not use symmetric endpoints like -2^(n-1) to 2^(n-1); the positive side stops one short because zero is included among the nonnegative values.
© 2023-2026 AI MATH COACH