sandbox
Loading...
Searching...
No Matches
constants.hpp
1#ifndef LIBSBX_MATH_CONSTANTS_HPP_
2#define LIBSBX_MATH_CONSTANTS_HPP_
3
4#include <cstdint>
5#include <cmath>
6#include <limits>
7#include <numbers>
8
9#include <libsbx/math/concepts.hpp>
10
11namespace sbx::math {
12
13template<floating_point Type>
14inline constexpr auto epsilon_v = std::numeric_limits<Type>::epsilon();
15
16inline constexpr auto epsilonf = epsilon_v<std::float_t>;
17
18inline constexpr auto epsilond = epsilon_v<std::double_t>;
19
20inline constexpr auto epsilon = epsilonf;
21
22template<floating_point Type>
23inline constexpr auto pi_v = std::numbers::pi_v<Type>;
24
25inline constexpr auto pif = pi_v<std::float_t>;
26
27inline constexpr auto pid = pi_v<std::double_t>;
28
29inline constexpr auto pi = pif;
30
31template<floating_point Type>
32inline constexpr auto two_pi_v = static_cast<Type>(2) * pi_v<Type>;
33
34inline constexpr auto two_pif = two_pi_v<std::float_t>;
35
36inline constexpr auto two_pid = two_pi_v<std::double_t>;
37
38inline constexpr auto two_pi = pif;
39
40} // namespace sbx::math
41
42#endif // LIBSBX_MATH_CONSTANTS_HPP_