Different Ways to Represent Signed Integer (original) (raw)

Last Updated : 12 Jun, 2026

A signed integer is a number that can be either positive or negative. Since computers store data in binary form, special methods are used to represent the sign of an integer.

**Example: For the decimal number +5, the binary representation is 00000101. For -5, the representation differs depending on whether Sign Bit, 1's Complement, or 2's Complement is used.

Signed Bit Representation

In the signed integer representation method, the following rules are followed:

1. The MSB (Most Significant Bit) represents the sign of the Integer.
2. Magnitude is represented by other bits other than MSB, i.e., (n-1) bits, where n is the number of bits.
3. If the number is positive, MSB is 0; else 1.
4. The range of signed integer representation of an n-bit number is given as –2n-1 - 1 to 2n-1 - 1.

**Example:

Let n = 4

**Range:

– (24-1 - 1) to 24-1 - 1
- (23- 1) to 23 - 1
- (7) to +7

For 4-bit representation, the minimum value = -7 and the maximum value=+7

**Positive Numbers
**Sign **Magnitude **Decimal Representation
0 0 0 0 +0
0 0 0 1 +1
0 0 1 0 +2
0 0 1 1 +3
0 1 0 0 +4
0 1 0 1 +5
0 1 1 0 +6
0 1 1 1 +7
**Negative Numbers
**Sign **Magnitude **Decimal Representation
1 0 0 0 -0
1 0 0 1 -1
1 0 1 0 -2
1 0 1 1 -3
1 1 0 0 -4
1 1 0 1 -5
1 1 1 0 -6
1 1 1 1 -7

**Drawbacks

Despite its simplicity, the sign-bit representation has several limitations that make arithmetic operations and number representation less efficient.

  1. For 0, there are two representations: -0 and +0 which should not be the case as 0 is neither –ve nor +ve.
  2. Out of 2n bits for representation, we are able to utilize only 2n-1 bits.Out of 2n bits for representation, we are able to utilize only 2n-1 bits.
  3. Numbers are not in cyclic order i.e. After the largest number (in this, for example, +7) the next number is not the least number (in this, for example, +0).
  4. For negative numbers signed extension does not work.
  5. As we can see above, for +ve representation, if 4 bits are extended to 5 bits there is a need to just append 0 in MSB.
  6. But if the same is done in –ve representation we won’t get the same number. i.e. 10101 ≠ 11101.

**Example:
Signed extension for +5

1

Signed extension for -5

2-

1’s Complement representation of a signed integer

In 1’s complement representation the following rules are used:

1. For +ve numbers the representation rules are the same as signed integer representation.
2. For –ve numbers, we can follow any one of the two approaches:

1’s complement of 0 = 1 and 1’s complement of 1 = 0

**Example:
(-5) in 1’s complement:
+5 = 0101
-5 = 1010

**Example:
X = -5
for n=4
24-1-5=10
10 in Binary System is written as: 1010(Unsigned)

3. The range of 1’s complement integer representation of n-bit number is given as –(2n-1 - 1) to 2n-1 - 1.

1’s Complement Representation

Positive Numbers
Sign Magnitude Number
0 0 0 0 +0
0 0 0 1 +1
0 0 1 0 +2
0 0 1 1 +3
0 1 0 0 +4
0 1 0 1 +5
0 1 1 0 +6
0 1 1 1 +7
**Negative Numbers
**Sign **Magnitude **Number
1 0 0 0 -7
1 0 0 1 -6
1 0 1 0 -5
1 0 1 1 -4
1 1 0 0 -3
1 1 0 1 -2
1 1 1 0 -1
1 1 1 1 -0

Drawbacks

  1. For 0, there are two representations: -0 and +0 which should not be the case as 0 is neither –ve nor +ve.
  2. Out of 2n bits for representation, we are able to utilize only 2n-1 bits.

Merits over Signed bit representation

1. Numbers are in cyclic order i.e. after the largest number (in this, for example, +7) the next number is the least number (in this, for example, -7).
2. For negative number signed extension works.

**Example: Signed extension for +5

1

Signed extension for -5

420851468

3. As it can be seen above, for +ve as well as -ve representation, if 4 bits are extended to 5 bits there is a need to just append 0/1 respectively in MSB.

**2’s Complement representation

2’s Complement is the most commonly used method for representing signed integers in computers. It simplifies arithmetic operations and provides a unique representation for zero.

Rules:

  1. **Positive numbers: Represented in the same way as unsigned binary numbers.
  2. **Negative numbers: Can be represented using either of the following methods:

_1_1111_

**Example: (-5) in 4-bit representation
2⁴ − 5 = 16 − 5 = 11 → 1011

**Example: (-5) in 4-bit representation
(+5) = 0101
1’s complement = 1010
Add 1 → 1010 + 1 = 1011
Therefore, (-5) = 1011

**3. Range: An n-bit 2’s complement number can represent values from −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1.

2’s Complement representation (4 bits)

**Merits:

  1. No ambiguity in the representation of 0.
  2. Numbers are in cyclic order i.e. after +7 comes -8.
  3. Signed Extension works.
  4. The range of numbers that can be represented using 2’s complement is very high.

Due to all of the above merits of 2’s complement representation of a signed integer, binary numbers are represented using 2’s complement method instead of signed bit and 1’s complement.