Integer Formats

Sign-Magnitude Representation (Original Binary Data)

To represent a singed decimal number in binary format, it uses the highest bit as sign bit to determine whether the binary number is negative.

00 stands for positive number and 11 means negative number.

One’s Complements (Radix-1 Complements)

  • Positive Number: Same as original.
  • Negative Number: Inverse all bits except the sign bit of a binary number.

Two’s Complements (Radix Complements)

  • Positive Number: Same as original.
  • Negative Number: Plus 11 on one’s complements.

Range of Representation

Suppose the data has nn bits.

Both sign-magnitude representation and one’s complements have +0+0 and 0-0, so the range is [2n11,2n11][-2^{n-1}-1, 2^{n-1}-1]

While two’s complements has only one 00, so the range is [2n1,2n11][-2^{n-1}, 2^{n-1}-1]

In conclusion:

Representation Range
Sign-Magnitude Representation [2n11,2n11][-2^{n-1}-1, 2^{n-1}-1]
One’s Complements [2n11,2n11][-2^{n-1}-1, 2^{n-1}-1]
Two’s Complements [2n1,2n11][-2^{n-1}, 2^{n-1}-1]

Application of Two’s Complements

When doing subtraction, like calculating aba-b, it can be converted to calculating a+(b)a + (-b), where b-b is generated by its two’s complements.

Last updated on