質問

Does STL contain definition for pi (=3.14...)? Certainly, I can use old good M_PI, but it is non-standard and not cross-compiler compliant.

役に立ちましたか?

解決

Boost.Math defines pi (and many other) mathematical constants to very high precision

#include <boost/math/constants.hpp>
long double pi = boost::math::constants::pi<long double>();

A full list is available here.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top