blob: 800b1f2a5c580b7067c158228bd22587174c3d95 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#ifndef COMMON_ALNUMBERS_H
#define COMMON_ALNUMBERS_H
#include <utility>
namespace al {
namespace numbers {
namespace detail_ {
template<typename T>
using as_fp = std::enable_if_t<std::is_floating_point<T>::value, T>;
} // detail_
template<typename T>
constexpr auto pi_v = detail_::as_fp<T>(3.141592653589793238462643383279502884L);
template<typename T>
constexpr auto inv_pi_v = detail_::as_fp<T>(0.318309886183790671537767526745028724L);
template<typename T>
constexpr auto sqrt2_v = detail_::as_fp<T>(1.414213562373095048801688724209698079L);
template<typename T>
constexpr auto sqrt3_v = detail_::as_fp<T>(1.732050807568877293527446341505872367L);
constexpr auto pi = pi_v<double>;
constexpr auto inv_pi = inv_pi_v<double>;
constexpr auto sqrt2 = sqrt2_v<double>;
constexpr auto sqrt3 = sqrt3_v<double>;
} // namespace numbers
} // namespace al
#endif /* COMMON_ALNUMBERS_H */
|