Texas Instruments TMS320C3x 사용자 설명서

다운로드
페이지 757
Fast Logarithms on a Floating-Point Device
5-45
Data Formats and Floating-Point Operation
N * log2(mant_old) = EXP_new + log2(mant_new)
log2(mant_old) = EXP_new/N + log2(mant_new)/N
This last equation shows that the logarithm of mant_old is indeed related to
EXP_new. And as shown earlier, EXP_new can be separated from the new
mantissa and used as the logarithm of the original mantissa.
We also need to consider the divisor N, which is defined to be the series 1, 2,
4, 8, 16... , and EXP_new is an integer. The division by N becomes a shift for
each squaring operation. What remains is to concatenate the bits of EXP_new
to EXP_old and then repeat the process until the desired accuracy is achieved.
5.11.1 Example of Fast Logarithm on a Floating-Point Device
Consider a mantissa value of 1.5 and an exponent value of 0 (giving an expo-
nent multiplier 2^0, or 1.0). The TMS320C30/C40 extended register bit pattern
for the algorithm sequence is shown below.
Table 5–3. Squaring Operation of F0 = 1.5
Squaring Operation of F0 = 1.5
Exp
S
Mantissa
00000000
0
1000000000000000000000000000000
X
=1.5
Exp=0
00000001
0
0010000000000000000000000000000
X^2
=2.25
Exp=1
00000010
0
0100010000000000000000000000000
X^4
=5.0625
Exp=2
00000100
0
1001101000010000000000000000000
X^8
=25.628906
Exp=4
00100100
0
0100100001101011101000001000000
X^16
=656.84083
Exp=9
00010010
0
1010010101010011111101110011111
X^32
=431.43988–E3
Exp=18
00100101
0
0101101010110110101000010101001
X^64
=186.14037–E9
Exp=37
01001010
0
1101010110010010001010101100011
X^128
=34.648238–E21
Exp=74
XXXXXXXX
S
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
Exp 
S
Mantissa
Hand-calculated value of log2(1.5)
log2(1.5) = 0.58496250 = 1001010 111000000
xxxxxxx– first 7 bits (exponent)
mmm– quick 3 bits (mantissa)
If you compare the hand-calculated value and the binary representation of
log2(1.5), you find that the sequence of bits in the exponent (seven bits worth)