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/TMS320C5545: Exponential function issue

Part Number: TMS320C5545

Tool/software: Code Composer Studio

Hi 

I'm using CCS to program c5545.

I want to calculate 10^(6.227).

But, error said it would be integer value.

Is there a way or function to calculate integer ^(float) ?

Thank you for the reading

Byte

  • Hello!

    May I ask to clarify, whether you see this error with either pow(10, 6.227) or log/exp sequence, because "^" symbol is used for exponential in other languages, but it is bitwise XOR in C, and is defined for integers.

  • Hi Minkyo,

    You should start with including math.h header. Then you need to use power of function pow(float a1, float a2) but if the first argument is integer you should cast it to float. See below the example:



    #include <stdio.h> #include <math.h> unsigned int a1; float res, a2; Void main() { a1 = 10; a2 = 6.227; res = pow((float)a1, a2); printf("%d ^ %f = %f\n", a1, a2, res); }

    Regards,

    Tsvetolin Shulev