Signed versus Unsigned Integers

ASDFdotASPX picture ASDFdotASPX · Oct 29, 2008 · Viewed 373.5k times · Source

Am I correct to say the difference between a signed and unsigned integer is:

  1. Unsigned can hold a larger positive value, and no negative value.
  2. Unsigned uses the leading bit as a part of the value, while the signed version uses the left-most-bit to identify if the number is positive or negative.
  3. signed integers can hold both positive and negative numbers.

Any other differences?

Answer

Greg picture Greg · Oct 29, 2008

Unsigned can hold a larger positive value, and no negative value.

Yes.

Unsigned uses the leading bit as a part of the value, while the signed version uses the left-most-bit to identify if the number is positive or negative.

There are different ways of representing signed integers. The easiest to visualise is to use the leftmost bit as a flag (sign and magnitude), but more common is two's complement. Both are in use in most modern microprocessors — floating point uses sign and magnitude, while integer arithmetic uses two's complement.

signed integers can hold both positive and negative numbers.

Yes