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 |
|
std::numbers::log2e |
2 |
std::numbers::log10e |
10 |
std::numbers::pi |
|
std::numbers::inv_pi |
|
std::numbers::inv_sqrtpi |
1/√π |
std::numbers::ln2 |
|
std::numbers::ln10 |
|
std::numbers::sqrt2 |
|
std::numbers::sqrt3 |
|
std::numbers::inv_sqrt3 |
|
std::numbers::egamma |
Euler-Mascheroni constant |
std::numbers::phi |
Get hands-on with 1200+ tech skills courses.