< previous page page_16 next page >

Page 16
d87111c01013bcda00bb8640fdff6754.gif
by both the hardware and the programmer. These include the radix and the position at the radix point (analogous to the decimal point) as well as the use of the "hidden one." Since a normalized floating-point number always has a nonzero (i.e., a one) leading bit (with radix equal two), this bit may be implied to be one. Then only the remaining bits of the fraction need to be stored as data, thus saving a bit and allowing an extra bit of fraction significance. Some details of floating-point representations are shown in Table 1.3. Usually floating-point numbers are represented as
0016-01.gif
d87111c01013bcda00bb8640fdff6754.gif
where char = biased exponent (characteristic). If char has p bits, then bias is typically ½ (radix)p and char = exponent + bias.5 For example, in a system with bias = 128, the exponent of -3 is represented as 125. Use of this representation (rather than, say, two's-complement) allows very small numbers to have small absolute exponents and zero to have a zero exponent.
d87111c01013bcda00bb8640fdff6754.gif
Thus, a number x is interpreted as
d87111c01013bcda00bb8640fdff6754.gif
x = (-1)s´ (Radix)char-bias ´ (1).mantissa,
d87111c01013bcda00bb8640fdff6754.gif
where radix, bias, hidden "1," and radix point are all implied.
d87111c01013bcda00bb8640fdff6754.gif
For example, the following are computational results and stored results (underlined data are stored as the mantissa):
d87111c01013bcda00bb8640fdff6754.gif
(a) IBM S/390
d87111c01013bcda00bb8640fdff6754.gif
Computed result 0.0101XXXX is stored as (.)0101XXXX, since no hidden "1" is used and "0101" is a normalized leading digit in hexadecimal.
d87111c01013bcda00bb8640fdff6754.gif
(b) VAX
d87111c01013bcda00bb8640fdff6754.gif
Computed result 0.0101XXXX is normalized to 0.101XXXX (with exponent decremented by one) and stored as (.)(1)01XXXX.
d87111c01013bcda00bb8640fdff6754.gif
(c) IEEE
d87111c01013bcda00bb8640fdff6754.gif
Computed result 0.0101XXXX is normalized to 1.01XXXX (with exponent decremented by two), then stored as (1)(.)01XXXX.
3. Decimals.
d87111c01013bcda00bb8640fdff6754.gif
Decimal numbers represent the bulk of the calculations performed by business applications, as they can represent decimal (base 10) numbers with no loss of precision through data conversion. This format has two major problems. The first is that the implementation of decimal operations is slow, since the numbers are stored, one digit per byte, in ASCII ("unpacked") format or in two digit per byte binary coded decimal (BCD, or "packed") format, neither of which is natural for most machines to perform calculations. (See Figure 1.13.) Many of the early microprocessors, however, included specific instructions
d87111c01013bcda00bb8640fdff6754.gif d87111c01013bcda00bb8640fdff6754.gif
5It is 2p-1 - 1 for the IEEE standard.

 
< previous page page_16 next page >