This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/TMS320C6455: using log10 function

Part Number: TMS320C6455
Other Parts Discussed in Thread: MATHLIB

Tool/software: TI-RTOS

Hi

I need to get " log10 " in my program but i couldn't find any library.

What sould I do?

Best Reards

  • Do you want a C64+ DSP architecture optimized function or the general RTS library function to implement this.

    For C67x DSP, we provide FastRTS library that implements optimized version of this function. The standard C64xplus RTS library also provides this function as you can see from the API reference here:
    www.ti.com/.../spru187n.pdf

    Regards,
    Rahul
  • Hi

    Thanks, I saw the general RTS library function in " spru187n.pdf ".

    I need a C64+ DSP architecture optimized function, Please guide me.

    Regards

  • Hi

    I'm waiting, please answer me.

    Regards

  • Dariush,

    Have you tried the standard run-time support library?

    Our documentation is not as robust as it once was, so we do not include documentation of all of the standard C library routines. We do support all standard C library routines, though. Doing an online search for "c library log10" found this tutorial. It includes a simple code example. Please let us know if you are able to get this build and have any other questions.

    Regards,
    RandyP

  • I don't know whether this is any help, but if you have a function that does natural logs (or any other base would work), you can use a math identity
    log10(x) = ln(x) / ln(10)

    ln(10) is a constant, so it's not much extra processing.

    Roy
  • Using math.h and mathf.h, this is useful and gives answer in 101 CPU clock cycles per sample.

    #include <math.h>
    #include <mathf.h>
    
    _out = log10f(_in);

    the other alternative suggested is great too. using logf() / logf(10)

    temp = (float) 1/ logf(10); // calculated once - before the for loop of an array
    
    for (i = 0; i < BUFFER; i++)
    		_out[i] = logf(_in[i])*temp;

    This gave me 84 cycles per floating point sample. Mathlib.lib has functions logsp and log10sp calculating faster than above mentioned. The following gave me logarithm base-10 in 72 cycles.

    #include <ti/mathlib/src/common/drvsp.h>
    #include <ti/mathlib/src/log10sp/log10sp.h>
    
    for (i = 0; i < BUFFER; i++)
    		_out[i] = log10sp(_in[i]);