Example Of Fast Logarithm On A Floating-Point Device; Squaring Operation Of F0 = 1.5 - Texas Instruments TMS320C3x User Manual

Texas instruments computer hardware user's guide
Table of Contents

Advertisement

5.11.1 Example of Fast Logarithm on a Floating-Point Device

Table 5–3. Squaring Operation of F0 = 1.5
Exp
Mantissa
S
00000000
0
1000000000000000000000000000000
00000001
0
0010000000000000000000000000000
00000010
0
0100010000000000000000000000000
00000100
0
1001101000010000000000000000000
00100100
0
0100100001101011101000001000000
00010010
0
1010010101010011111101110011111
00100101
0
0101101010110110101000010101001
01001010
0
1101010110010010001010101100011
XXXXXXXX
S
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
Exp
S
N * l og 2 (mant_old) = EXP_new + log 2 (mant_new)
log 2 (mant_old) = EXP_new / N + l og 2 (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.
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.

Squaring Operation of F0 = 1.5

Mantissa
Hand-calculated value of log2(1.5)
log 2(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)
Fast Logarithms on a Floating-Point Device
X
X^2
X^4
X^8
X^16
X^32
X^64
X^128
Data Formats and Floating-Point Operation
=1.5
Exp=0
=2.25
Exp=1
=5.0625
Exp=2
=25.628906
Exp=4
=656.84083
Exp=9
=431.43988–E3
Exp=18
=186.14037–E9
Exp=37
=34.648238–E21
Exp=74
5-45

Advertisement

Table of Contents
loading

Table of Contents