Monday, 13 June 2011

Difference between signed integers and unsigned integers


A signed integer is one with either a plus or minus sign 
in front. That is it can be either positive or negative.
An unsigned integer is assumed to be positive.

This is important in computing because the numbers are
stored (usually) as a fixed number of binary digits. For
a signed integer one bit is used to indicate the sign
- 1 for negative, zero for positive. Thus a 16 bit signed
integer only has 15 bits for data whereas a 16 bit unsigned
integer has all 16 bits available. This means unsigned
integers can have a value twice as high as signed integers
(but only positive values).

1 comment: