1818#include < array>
1919#include < cmath>
2020#include < complex>
21+ #include < numbers>
2122#include < type_traits>
2223
2324#include < xtl/xcomplex.hpp>
@@ -38,18 +39,18 @@ namespace xt
3839 template <class T = double >
3940 struct numeric_constants
4041 {
41- static constexpr T PI = 3.141592653589793238463 ;
42- static constexpr T PI_2 = 1.57079632679489661923 ;
43- static constexpr T PI_4 = 0.785398163397448309616 ;
44- static constexpr T D_1_PI = 0.318309886183790671538 ;
45- static constexpr T D_2_PI = 0.636619772367581343076 ;
46- static constexpr T D_2_SQRTPI = 1.12837916709551257390 ;
47- static constexpr T SQRT2 = 1.41421356237309504880 ;
48- static constexpr T SQRT1_2 = 0.707106781186547524401 ;
49- static constexpr T E = 2.71828182845904523536 ;
50- static constexpr T LOG2E = 1.44269504088896340736 ;
51- static constexpr T LOG10E = 0.434294481903251827651 ;
52- static constexpr T LN2 = 0.693147180559945309417 ;
42+ static constexpr T PI = std::numbers::pi_v<T> ;
43+ static constexpr T PI_2 = 0.5 *PI ;
44+ static constexpr T PI_4 = 0.25 *PI ;
45+ static constexpr T D_1_PI = std::numbers::inv_pi_v<T> ;
46+ static constexpr T D_2_PI = 2 *std::numbers::inv_pi_v<T> ;
47+ static constexpr T D_2_SQRTPI = 2 *std::numbers::inv_sqrtpi_v<T> ;
48+ static constexpr T SQRT2 = std::numbers::sqrt2_v<T> ;
49+ static constexpr T SQRT1_2 = 0.5 *std::numbers::sqrt2_v<T> ;
50+ static constexpr T E = std::numbers::e_v<T> ;
51+ static constexpr T LOG2E = std::numbers::log2e_v<T> ;
52+ static constexpr T LOG10E = std::numbers::log10e_v<T> ;
53+ static constexpr T LN2 = std::numbers::ln2_v<T> ;
5354 };
5455
5556 /* **********
0 commit comments