Mathematical Constants

Get familiar with the basic mathematical constants provided by 'std::numbers'.

First of all, the constants require the header <numbers> and the namespace std::numbers. The following table gives you an overview.

Mathematical constant Description
std::numbers::e ee
std::numbers::log2e loglog2 ee
std::numbers::log10e loglog10 ee
std::numbers::pi ππ
std::numbers::inv_pi 1/Ï€1/Ï€
std::numbers::inv_sqrtpi 1/√π
std::numbers::ln2 ln2ln 2
std::numbers::ln10 ln10ln 10
std::numbers::sqrt2 2\sqrt{2}
std::numbers::sqrt3 3\sqrt{3}
std::numbers::inv_sqrt3 13\frac{1}{\sqrt{3}}
std::numbers::egamma Euler-Mascheroni constant
std::numbers::phi φφ

Get hands-on with 1400+ tech skills courses.