16 #ifndef KOKKOS_MATHEMATICAL_CONSTANTS_HPP
17 #define KOKKOS_MATHEMATICAL_CONSTANTS_HPP
18 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
19 #define KOKKOS_IMPL_PUBLIC_INCLUDE
20 #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_MATHCONSTANTS
23 #include <Kokkos_Macros.hpp>
24 #include <type_traits>
26 namespace Kokkos::numbers {
28 #define KOKKOS_IMPL_MATH_CONSTANT(TRAIT, VALUE) \
30 inline constexpr auto TRAIT##_v = \
31 std::enable_if_t<std::is_floating_point_v<T>, T>(VALUE); \
32 inline constexpr auto TRAIT = TRAIT##_v<double>
35 KOKKOS_IMPL_MATH_CONSTANT(e, 2.718281828459045235360287471352662498L);
36 KOKKOS_IMPL_MATH_CONSTANT(log2e, 1.442695040888963407359924681001892137L);
37 KOKKOS_IMPL_MATH_CONSTANT(log10e, 0.434294481903251827651128918916605082L);
38 KOKKOS_IMPL_MATH_CONSTANT(pi, 3.141592653589793238462643383279502884L);
39 KOKKOS_IMPL_MATH_CONSTANT(inv_pi, 0.318309886183790671537767526745028724L);
40 KOKKOS_IMPL_MATH_CONSTANT(inv_sqrtpi, 0.564189583547756286948079451560772586L);
41 KOKKOS_IMPL_MATH_CONSTANT(ln2, 0.693147180559945309417232121458176568L);
42 KOKKOS_IMPL_MATH_CONSTANT(ln10, 2.302585092994045684017991454684364208L);
43 KOKKOS_IMPL_MATH_CONSTANT(sqrt2, 1.414213562373095048801688724209698079L);
44 KOKKOS_IMPL_MATH_CONSTANT(sqrt3, 1.732050807568877293527446341505872367L);
45 KOKKOS_IMPL_MATH_CONSTANT(inv_sqrt3, 0.577350269189625764509148780501957456L);
46 KOKKOS_IMPL_MATH_CONSTANT(egamma, 0.577215664901532860606512090082402431L);
47 KOKKOS_IMPL_MATH_CONSTANT(phi, 1.618033988749894848204586834365638118L);
50 #undef KOKKOS_IMPL_MATH_CONSTANT
54 #ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_MATHCONSTANTS
55 #undef KOKKOS_IMPL_PUBLIC_INCLUDE
56 #undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_MATHCONSTANTS