- Signed integers are generally encoded in two’s complement.
- The most significant bit (MSB) is interpreted as having a negative weight
Two’s complement encoding
Formula
For a vector , the corresponding integer can be calculated using the following formula (where means binary to two’s complement, length bits)
About the most significant bit (MSB)
- The MSB is called the sign bit
- Its weight is - the negation of its weight in unsigned representation
- When it is set to , the represented integral value is negative. When it is set to , the represented integral value is non-negative.
Examples
Visual example

Range of values
- Consider a -bit two’s complement number
- The least representable value is given be vector , having integer value
- The largest value is given by the vector , which has the integer value of:
Example
- When