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/MSP430G2553: How to use the math constant 'Pi' ?

Part Number: MSP430G2553

Tool/software: Code Composer Studio

Hello!

How do I use the math constant Pi in my CCS code? I included the math.h header file. I used the identifier 'PI'.

However, the compiler gives the error that the identifier is undefined.

Thank You

  • Hello, 

    math.h defines: 

    #define M_PI 3.14159265358979323846 /* pi */
    #define M_PI_2 1.57079632679489661923 /* pi/2 */
    #define M_PI_4 0.78539816339744830962 /* pi/4 */
    #define M_1_PI 0.31830988618379067154 /* 1/pi */
    #define M_2_PI 0.63661977236758134308 /* 2/pi */
    #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */