Why is there no definition of the constant pi in the C++11 standard? [closed]

徘徊边缘 提交于 2019-12-04 02:47:18

问题


I find it quiet annoying that I have to use the macro _USE_MATH_DEFINES in order to get the value of pi into my program. Or I need to define it myself in one of my own headers. Or I have to use boost and all that.

It just annoys me, that there isn't a standard c++ header defining that constant in a portable way. Is there any particular reason that math constants like pi are not in the c++ standard? Could it be in one of the next versions of the standard?


回答1:


I would assume its not standardized because its not really a major concern. I really do not see any hassle in just writing down a #define or const static, or just making a header with a bunch of math constants you may need. Its not really anything anyone composing the standard has on his mind while trying to improve the language.



来源:https://stackoverflow.com/questions/18361812/why-is-there-no-definition-of-the-constant-pi-in-the-c11-standard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!