4.11. Sign-Magnitude

4.11.1. Format

The sign-magnitude binary format is the simplest conceptual format. To represent a number in sign-magnitude, we simply use the leftmost bit to represent the sign, where 0 means positive, and the remaining bits to represent the magnitude (absolute value).

A 8-bit sign-magnitude number would appear as follows:

Table 4.3. 8-bit sign-magnitude format

SignMagnitude
76-0

4.11.2. Negation

To negate sign-magnitude numbers, simply toggle the sign bit. Note that this leads to having two representations for the number zero.

4.11.3. Conversions

What are the decimal values of the following 8-bit sign-magnitude numbers?

  • 10000011 = -3
  • 00000101 = +5
  • 11111111 = ?
  • 01111111 = ?

Represent the following in 8-bit sign-magnitude:

  • -15 = 10001111
  • +7 = 00000111
  • -1 = ?

4.11.4. Addition and Subtraction

Addition and subtraction require attention to the sign bit. If the signs are the same, we simply add the magnitudes as unsigned numbers and watch for overflow. If the signs differ, we subtract the smaller magnitude from the larger, and keep the sign of the larger.

4.11.5. Range

Since the magnitude is an unsigned binary number, range is computed as it is for unsigned binary, but with one less bit. Hence, for 8-bit sign-magnitude, the range is +/- 27-1.

4.11.6. Comparison

Comparison works as with unsigned binary if the signs are the same. If the signs differ, the positive value is larger.