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.

CCS/MSP430G2253: How to do log and anti log functions in MSP430G2253

Part Number: MSP430G2253

Tool/software: Code Composer Studio

Hi All,

I am using MSP430G2253 controller in one my project,Now I want to do  implement log and anti log  functions.Is it possible to use log and anti log math library.

If possible how can implement in the  code?

I tried as below ,but the compiler shows error #29 expected an expression

i=log(double (j);



  • >i=log(double (j);

    This statement is missing a parenthesis. That's what the compiler was complaining about. It should be:

    > i=log((double) j);

    As far as I know, the log() function (and exp()) is in the C math library. (Be sure to "#include <math.h>") However, it works with floating point, and I'm not sure whether the required floating point support will fit in the 2KB of flash in your MCU. You might do better with something like IQMathlib and fixed-point arithmetic.

    [Edit: Fixed wording.]