std::numbers(3)
π std::numbers(3) π
okay bestie, come closer β this is the std::numbers page from the Library Functions Manual and it's literally just a whole namespace of mathematical constants and the way I'm obsessed?? β¨ no cap.
πΈ NAME πΈ
std::numbers β the namespace for mathematical constants, periodt.
β¨ SYNOPSIS β¨
π Variables
so here's the whole squad, one constexpr double plus its templated _v bestie for each one:
constexpr double e
template<typename _Tp > constexpr _Tp e_v
e
constexpr double egamma
template<typename _Tp > constexpr _Tp egamma_v
The Euler-Mascheroni constant.
constexpr double inv_pi
template<typename _Tp > constexpr _Tp inv_pi_v
1/pi
constexpr double inv_sqrt3
template<typename _Tp > constexpr _Tp inv_sqrt3_v
1/sqrt(3)
constexpr double inv_sqrtpi
template<typename _Tp > constexpr _Tp inv_sqrtpi_v
1/sqrt(pi)
constexpr double ln10
template<typename _Tp > constexpr _Tp ln10_v
log_e 10
constexpr double ln2
template<typename _Tp > constexpr _Tp ln2_v
log_e 2
constexpr double log10e
template<typename _Tp > constexpr _Tp log10e_v
log_10 e
constexpr double log2e
template<typename _Tp > constexpr _Tp log2e_v
log_2 e
constexpr double phi
template<typename _Tp > constexpr _Tp phi_v
The golden ratio, (1+sqrt(5))/2.
constexpr double pi
template<typename _Tp > constexpr _Tp pi_v
pi
constexpr double sqrt2
template<typename _Tp > constexpr _Tp sqrt2_v
sqrt(2)
constexpr double sqrt3
template<typename _Tp > constexpr _Tp sqrt3_v
sqrt(3)
like, every constant gets a _v version where you can pick your _Tp β¨ it's giving "have it your way" π
π¦ Detailed Description π¦
Namespace for mathematical constants. that's it, that's the whole vibe check β it's a namespace, it holds math constants, it slays π«Ά
π Variable Documentation π
each one of these is tagged [inline] and [constexpr], iykyk π
template<typename _Tp > constexpr _Tp std::numbers::e_v [inline], [constexpr]βeπtemplate<typename _Tp > constexpr _Tp std::numbers::egamma_v [inline], [constexpr]β The Euler-Mascheroni constant. the icon herself πtemplate<typename _Tp > constexpr _Tp std::numbers::inv_pi_v [inline], [constexpr]β1/piπΈtemplate<typename _Tp > constexpr _Tp std::numbers::inv_sqrt3_v [inline], [constexpr]β1/sqrt(3)βtemplate<typename _Tp > constexpr _Tp std::numbers::inv_sqrtpi_v [inline], [constexpr]β1/sqrt(pi)π§template<typename _Tp > constexpr _Tp std::numbers::ln10_v [inline], [constexpr]βlog_e 10πtemplate<typename _Tp > constexpr _Tp std::numbers::ln2_v [inline], [constexpr]βlog_e 2πtemplate<typename _Tp > constexpr _Tp std::numbers::log10e_v [inline], [constexpr]βlog_10 eπ₯template<typename _Tp > constexpr _Tp std::numbers::log2e_v [inline], [constexpr]βlog_2 eβtemplate<typename _Tp > constexpr _Tp std::numbers::phi_v [inline], [constexpr]β The golden ratio,(1+sqrt(5))/2. main character energy fr fr πtemplate<typename _Tp > constexpr _Tp std::numbers::pi_v [inline], [constexpr]βpiπtemplate<typename _Tp > constexpr _Tp std::numbers::sqrt2_v [inline], [constexpr]βsqrt(2)π¦template<typename _Tp > constexpr _Tp std::numbers::sqrt3_v [inline], [constexpr]βsqrt(3)β¨
ngl bestie, the_vones are the ones documented in detail here β the plainconstexpr doubleversions show up in the synopsis up top, don't forget about them π
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. not me being autogenerated by a doc tool π iconic behaviour honestly.
and that's the page!! this came out of libstdc++, dated Fri Feb 14 2025 β happy valentine's day from the standard library I guess πππ«Ά see u in the next one, bestie! π
π¦ where this page comes from
- centos-stream 9: gcc-toolset-13-libstdc++-docs 13.3.1-2.3.el9 Β· GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms