41 lines
6.6 KiB
Markdown
41 lines
6.6 KiB
Markdown
[numbers]
|
||
|
||
# 29 Numerics library [[numerics]](./#numerics)
|
||
|
||
## 29.8 Numbers [numbers]
|
||
|
||
### [29.8.1](#syn) Header <numbers> synopsis [[numbers.syn]](numbers.syn)
|
||
|
||
[ð](#header:%3cnumbers%3e)
|
||
|
||
namespace std::numbers {template<class T> constexpr T [e_v](#lib:e_v "29.8.1 Header <numbers> synopsis [numbers.syn]") = *unspecified*; template<class T> constexpr T [log2e_v](#lib:log2e_v "29.8.1 Header <numbers> synopsis [numbers.syn]") = *unspecified*; template<class T> constexpr T [log10e_v](#lib:log10e_v "29.8.1 Header <numbers> synopsis [numbers.syn]") = *unspecified*; template<class T> constexpr T [pi_v](#lib:pi_v "29.8.1 Header <numbers> synopsis [numbers.syn]") = *unspecified*; template<class T> constexpr T [inv_pi_v](#lib:inv_pi_v "29.8.1 Header <numbers> synopsis [numbers.syn]") = *unspecified*; template<class T> constexpr T [inv_sqrtpi_v](#lib:inv_sqrtpi_v "29.8.1 Header <numbers> synopsis [numbers.syn]") = *unspecified*; template<class T> constexpr T [ln2_v](#lib:ln2_v "29.8.1 Header <numbers> synopsis [numbers.syn]") = *unspecified*; template<class T> constexpr T [ln10_v](#lib:ln10_v "29.8.1 Header <numbers> synopsis [numbers.syn]") = *unspecified*; template<class T> constexpr T [sqrt2_v](#lib:sqrt2_v "29.8.1 Header <numbers> synopsis [numbers.syn]") = *unspecified*; template<class T> constexpr T [sqrt3_v](#lib:sqrt3_v "29.8.1 Header <numbers> synopsis [numbers.syn]") = *unspecified*; template<class T> constexpr T [inv_sqrt3_v](#lib:inv_sqrt3_v "29.8.1 Header <numbers> synopsis [numbers.syn]") = *unspecified*; template<class T> constexpr T [egamma_v](#lib:egamma_v "29.8.1 Header <numbers> synopsis [numbers.syn]") = *unspecified*; template<class T> constexpr T [phi_v](#lib:phi_v "29.8.1 Header <numbers> synopsis [numbers.syn]") = *unspecified*; template<[floating_point](concepts.arithmetic#concept:floating_point "18.4.7 Arithmetic concepts [concepts.arithmetic]") T> constexpr T e_v<T> = *see below*; template<[floating_point](concepts.arithmetic#concept:floating_point "18.4.7 Arithmetic concepts [concepts.arithmetic]") T> constexpr T log2e_v<T> = *see below*; template<[floating_point](concepts.arithmetic#concept:floating_point "18.4.7 Arithmetic concepts [concepts.arithmetic]") T> constexpr T log10e_v<T> = *see below*; template<[floating_point](concepts.arithmetic#concept:floating_point "18.4.7 Arithmetic concepts [concepts.arithmetic]") T> constexpr T pi_v<T> = *see below*; template<[floating_point](concepts.arithmetic#concept:floating_point "18.4.7 Arithmetic concepts [concepts.arithmetic]") T> constexpr T inv_pi_v<T> = *see below*; template<[floating_point](concepts.arithmetic#concept:floating_point "18.4.7 Arithmetic concepts [concepts.arithmetic]") T> constexpr T inv_sqrtpi_v<T> = *see below*; template<[floating_point](concepts.arithmetic#concept:floating_point "18.4.7 Arithmetic concepts [concepts.arithmetic]") T> constexpr T ln2_v<T> = *see below*; template<[floating_point](concepts.arithmetic#concept:floating_point "18.4.7 Arithmetic concepts [concepts.arithmetic]") T> constexpr T ln10_v<T> = *see below*; template<[floating_point](concepts.arithmetic#concept:floating_point "18.4.7 Arithmetic concepts [concepts.arithmetic]") T> constexpr T sqrt2_v<T> = *see below*; template<[floating_point](concepts.arithmetic#concept:floating_point "18.4.7 Arithmetic concepts [concepts.arithmetic]") T> constexpr T sqrt3_v<T> = *see below*; template<[floating_point](concepts.arithmetic#concept:floating_point "18.4.7 Arithmetic concepts [concepts.arithmetic]") T> constexpr T inv_sqrt3_v<T> = *see below*; template<[floating_point](concepts.arithmetic#concept:floating_point "18.4.7 Arithmetic concepts [concepts.arithmetic]") T> constexpr T egamma_v<T> = *see below*; template<[floating_point](concepts.arithmetic#concept:floating_point "18.4.7 Arithmetic concepts [concepts.arithmetic]") T> constexpr T phi_v<T> = *see below*; inline constexpr double [e](#lib:e "29.8.1 Header <numbers> synopsis [numbers.syn]") = e_v<double>; inline constexpr double [log2e](#lib:log2e "29.8.1 Header <numbers> synopsis [numbers.syn]") = log2e_v<double>; inline constexpr double [log10e](#lib:log10e "29.8.1 Header <numbers> synopsis [numbers.syn]") = log10e_v<double>; inline constexpr double [pi](#lib:pi "29.8.1 Header <numbers> synopsis [numbers.syn]") = pi_v<double>; inline constexpr double [inv_pi](#lib:inv_pi "29.8.1 Header <numbers> synopsis [numbers.syn]") = inv_pi_v<double>; inline constexpr double [inv_sqrtpi](#lib:inv_sqrtpi "29.8.1 Header <numbers> synopsis [numbers.syn]") = inv_sqrtpi_v<double>; inline constexpr double [ln2](#lib:ln2 "29.8.1 Header <numbers> synopsis [numbers.syn]") = ln2_v<double>; inline constexpr double [ln10](#lib:ln10 "29.8.1 Header <numbers> synopsis [numbers.syn]") = ln10_v<double>; inline constexpr double [sqrt2](#lib:sqrt2 "29.8.1 Header <numbers> synopsis [numbers.syn]") = sqrt2_v<double>; inline constexpr double [sqrt3](#lib:sqrt3 "29.8.1 Header <numbers> synopsis [numbers.syn]") = sqrt3_v<double>; inline constexpr double [inv_sqrt3](#lib:inv_sqrt3 "29.8.1 Header <numbers> synopsis [numbers.syn]") = inv_sqrt3_v<double>; inline constexpr double [egamma](#lib:egamma "29.8.1 Header <numbers> synopsis [numbers.syn]") = egamma_v<double>; inline constexpr double [phi](#lib:phi "29.8.1 Header <numbers> synopsis [numbers.syn]") = phi_v<double>;}
|
||
|
||
### [29.8.2](#math.constants) Mathematical constants [[math.constants]](math.constants)
|
||
|
||
[1](#math.constants-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10887)
|
||
|
||
The library-defined partial specializations
|
||
of mathematical constant variable templates
|
||
are initialized with the nearest representable values ofe,log2e,log10e,Ï,1Ï,1âÏ,ln2,ln10,â2,â3,1â3,
|
||
the Euler-Mascheroni γ constant, and
|
||
the golden ratio Ï constant 1+â52,
|
||
respectively[.](#math.constants-1.sentence-1)
|
||
|
||
[2](#math.constants-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10906)
|
||
|
||
Pursuant to [[namespace.std]](namespace.std "16.4.5.2.1 Namespace std"),
|
||
a program may partially or explicitly specialize
|
||
a mathematical constant variable template
|
||
provided that the specialization depends on a program-defined type[.](#math.constants-2.sentence-1)
|
||
|
||
[3](#math.constants-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10912)
|
||
|
||
A program that instantiates a primary template
|
||
of a mathematical constant variable template is ill-formed[.](#math.constants-3.sentence-1)
|