Lower the priority of the JACK backend
[openal-soft.git] / common / alnumbers.h
blob6d201ad4f50a05438fe457570167e74b96d691ee
1 #ifndef COMMON_ALNUMBERS_H
2 #define COMMON_ALNUMBERS_H
4 #include <type_traits>
6 namespace al::numbers {
8 namespace detail_ {
9 template<typename T>
10 using as_fp = std::enable_if_t<std::is_floating_point<T>::value, T>;
11 } // detail_
13 template<typename T>
14 inline constexpr auto pi_v = detail_::as_fp<T>(3.141592653589793238462643383279502884L);
16 template<typename T>
17 inline constexpr auto inv_pi_v = detail_::as_fp<T>(0.318309886183790671537767526745028724L);
19 template<typename T>
20 inline constexpr auto sqrt2_v = detail_::as_fp<T>(1.414213562373095048801688724209698079L);
22 template<typename T>
23 inline constexpr auto sqrt3_v = detail_::as_fp<T>(1.732050807568877293527446341505872367L);
25 inline constexpr auto pi = pi_v<double>;
26 inline constexpr auto inv_pi = inv_pi_v<double>;
27 inline constexpr auto sqrt2 = sqrt2_v<double>;
28 inline constexpr auto sqrt3 = sqrt3_v<double>;
30 } // namespace al::numbers
32 #endif /* COMMON_ALNUMBERS_H */