< previous page page_14 next page >

Page 14
0014-01.gif
Figure 1.12
Typical data types.
1. Integers (signed or unsigned whole numbers).
d87111c01013bcda00bb8640fdff6754.gif
Integers are the fundamental data type used in computers. Other numeric data types may be readily assembled using this data type.2 Different formats may be used to represent signed numbers, by far the most common of which is the two's-complement representation. This is the representation formed by using -a = 0 - a.3 The advantage of this format is that no special care need be taken with numbers after conversion (which does, however, require a subtraction) is complete. Less common is the one's-complement representation that is formed by -a = NOT a.4 This representation is much easier for converting between formats, but has several undesirable propertiesnot the least of which is that -0 does not have the same pattern as +0 (or unsigned 0 = +0).
d87111c01013bcda00bb8640fdff6754.gif d87111c01013bcda00bb8640fdff6754.gif
2Actually, bit strings form the basis for computer arithmetic. However, as bit strings do not provide any numeric functionality, their use as a basis for operations is fine for actual hardware (where everything is really a bit string), but complicates any practical discussion of arithmetic.
d87111c01013bcda00bb8640fdff6754.gif d87111c01013bcda00bb8640fdff6754.gif
3More formally, for an n bit binary number, -a = (2n - a) mod 2n, where 2n-1 > a
d87111c01013bcda00bb8640fdff6754.gif d87111c01013bcda00bb8640fdff6754.gif
4Or -a = (2n - 1 - a) mod (2n - 1). The dual representations of zero (all 1's or all 0's) occur because 0 º (2n - 1) mod (2n - 1).

 
< previous page page_14 next page >