Using M_PI with C89 standard

后端 未结 4 1574
执念已碎
执念已碎 2020-11-27 08:25

I\'m using C and trying to get access to the constant M_PI (3.14159...). I have imported the math.h header file, but the M_PI constant was still undefined. Through some sear

4条回答
  •  情书的邮戳
    2020-11-27 08:50

    M_PI is not required by the C standard, it's just a common extension, so if you want to be standard you shouldn't rely on it. However, you can easily define your own #define for it, last time I checked it was a universal constant so there's not much space for confusion. :)

提交回复
热议问题