Download "TMS320C54x DSP Library User's Guide"

Transcript
log_10
Benchmarks
Cycles
Core:
60*nx
Overhead 56
Code size (in 16-bit words) 85
log_10
Base 10 Logarithm
Function
short oflag = log_10 (DATA *x, LDATA *r, ushort nx)
(defined in log_10.asm)
Arguments
x[nx]
Pointer to input vector of size nx
r[nx]
Pointer to output data vector (Q31 format) of size nx
nx
Length of input and output data vectors
oflag
Overflow flag
- If oflag = 1 a 32-bit overflow has occurred
- If oflag =0 a 32-bit overflow has not occurred
Description
Computes the log base 10 of elements of vector x using Taylor series.
Algorithm
for (i + 0; i t nx; i ) )) y(i) + log10 x(i)
Overflow Handling Methodology
where * 1 t x(i) t 1
No scaling implemented for overflow prevention.
Special Requirements none
Implementation Notes y = 0.4343 * ln(x) with x = M(x)*2^P(x) = M*2^P
y = 0.4343 * (ln(M) + ln(2)*P)
y = 0.4343 * (ln(2*M) + (P–1)*ln(2))
y = 0.4343 * (ln((2*M–1)+1) + (P–1)*ln(2))
y = 0.4343 * (f(2*M–1) + (P–1)*ln(2))
with f(u) = ln(1+u).
We use a polynomial approximation for f(u):
f(u) = (((((C6*u+C5)*u+C4)*u+C3)*u+C2)*u+C1)*u+C0
for 0<= u <= 1.
The polynomial coefficients Ci are as follows:
C0 = 0.000 001 472
C1 = 0.999 847 766
C2 = –0.497 373 368
C3 = 0.315 747 760
C4 = –0.190 354 944
C5 = 0.082 691 584
C6 = –0.017 414 144
4-50