Points to consider – Texas Instruments TMS320C3x User Manual

Page 152

Advertising
background image

Fast Logarithms on a Floating-Point Device

5-47

Data Formats and Floating-Point Operation

When finished, the bits representing the finished logarithm are in a fixed-point
notation and need to be scaled. This is done by using the FLOAT instruction fol-
lowed by a multiplication by a constant scaling factor. If the final result needs to
be in any other base, the scaling factor is simply adjusted for that base.

5.11.2 Points to Consider

The round-off accuracy of the first three squaring operations affect the final
result if >21 mantissa bits are desired. A RND instruction placed after the first
three MPYF R0,R0 instructions remedy this, but adds to the cycle count.

When the input value approaches 1.0, the result is driven close to zero and
accuracy suffers. In this case, an input range comparison and a branch to a
McLauren series expansion is used as a solution with minimal degradation in
speed. This is because the power series converges quickly for input values
close to 1.0.

If you only need to calculate a visual quality logarithm, such as in spectrum
analysis, the logarithm can often be calculated in one cycle. In this case the
mantissa is substituted directly into the fractional bits of the logarithm giving
a maximum error of 0.086 (about 3.5 bits). The one cycle arises from the need
to remove the 2’s compliment sign bit in the ’C3x’s mantissa.

Advertising