Professional Documents
Culture Documents
Figs B
Figs B
FLOATING-POINT NUMBERS
10100
10100 0
10100
10100
Figure B-1. The real number line can be divided into seven regions.
Digits in fraction Digits in exponent Lower bound Upper bound 3 3 3 3 4 4 4 4 5 5 5 5 10 20 1 2 3 4 1 2 3 4 1 2 3 4 3 3 1012 10102 101002 1010002 1013 10103 101003 1010003 1014 10104 101004 1010004 101009 101019 109 1099 10999 109999 109 1099 10999 109999 109 1099 10999 109999 10999 10999
Figure B-2. The approximate lower and upper bounds of expressible (unnormalized) floating-point decimal numbers.
24 2
3
26 2
5
28 2
7
210 2
9
212
11
214
13
216
15
Unnormalized:
0 1010100
+ 1 216) = 432 Sign Excess 64 Fraction is 1 212+ 1 213 15 16 + exponent is +1 2 + 1 2 84 64 = 20 To normalize, shift the fraction left 11 bits and subtract 11 from the exponent. Normalized: 0 1001001 Sign Excess 64 + exponent is 73 64 = 9
.0
20 12 13 15 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 = 2 (1 2 + 1 2 + 1 2
.1
1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 = 29 (1 21+ 1 22+ 1 24 Fraction is 1 21 + 1 22 +1 24 + 1 25 Example 2: Exponentiation to the base 16 161 162 0 0 00 163 0 0 01 164 1 0 1 1 = 165 (1 163+ B 164) = 432 + 1 25) = 432
Unnormalized:
0 0 00
To normalize, shift the fraction left 2 hexadecimal digits, and subtract 2 from the exponent. Normalized: 0 1000011 Sign Excess 64 + exponent is 67 64 = 3
0001
1011
0000
Bits 1
23 Fraction
Sign
Exponent (a)
Bits 1
52 Fraction
Figure B-4. IEEE floating-point formats. (a) Single precision. (b) Double precision.
Item Bits in sign Bits in exponent Bits in fraction Bits, total Exponent system Exponent range Smallest normalized number Largest normalized number Decimal range Smallest denormalized number
Single precision 1 8 23 32 Excess 127 126 to +127 2126 approx. 2128 approx. 1045
Double precision 1 11 52 64 Excess 1023 1022 to +1023 21022 approx. 21024 approx. 10324
Any bit pattern Any nonzero bit pattern 0 0 Any nonzero bit pattern