|
|
 |
|
|
|
|
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 |
|
|
|
 |
|
|
|
|
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. |
|
|
|
 |
|
|
|
|
Thus, a number x is interpreted as |
|
|
|
 |
|
|
|
|
x = (-1)s´ (Radix)char-bias ´ (1).mantissa, |
|
|
|
 |
|
|
|
|
where radix, bias, hidden "1," and radix point are all implied. |
|
|
|
 |
|
|
|
|
For example, the following are computational results and stored results (underlined data are stored as the mantissa): |
|
|
|
 |
|
|
|
|
(a) IBM S/390 |
|
|
|
 |
|
|
|
|
Computed result 0.0101XXXX is stored as (.)0101XXXX, since no hidden "1" is used and "0101" is a normalized leading digit in hexadecimal. |
|
|
|
 |
|
|
|
|
(b) VAX |
|
|
|
 |
|
|
|
|
Computed result 0.0101XXXX is normalized to 0.101XXXX (with exponent decremented by one) and stored as (.)(1)01XXXX. |
|
|
|
 |
|
|
|
|
(c) IEEE |
|
|
|
 |
|
|
|
|
Computed result 0.0101XXXX is normalized to 1.01XXXX (with exponent decremented by two), then stored as (1)(.)01XXXX. |
|
|
|
 |
|
|
|
|
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 |
|
|
|
 |
|
 |
|
|
5It is 2p-1 - 1 for the IEEE standard. |
|
|
|
|
|