#include <boost/math/constants/constants.hpp> // header file #include <iostream> // for output int main(void) { double PI = boost::math::constants::pi<double>(); // Define pi as the variable "PI" double E = boost::math::constants::e<double>(); // Define e as the variable "E" std::cout.precision(16); // output with 16 digits std::cout << "pi=" << PI << std::endl; std::cout << "e=" << E << std::endl; return 0; }
You can also find several other constants in /usr/include/boost/math/constants/constants.hpp