16template <
typename T =
float>
17[[nodiscard]]
constexpr T
nan() noexcept {
18 return std::numeric_limits<T>::quiet_NaN();
30[[nodiscard]]
constexpr T
Eps(T FloatEps = T(1e-7), T DoubleEps = T(1e-16)) {
31 if constexpr (std::is_same_v<T, float>) {
33 }
else if constexpr (std::is_same_v<T, double>) {
39template <
typename T =
float>
40[[nodiscard]]
constexpr T
ln2() noexcept {
41 return 0.69314718055994530942;
49template <
typename T =
float>
50[[nodiscard]]
constexpr T
pi() noexcept {
51 return 3.14159265358979323846;
59template <
typename T =
float>
60[[nodiscard]]
constexpr T
twopi() noexcept {
61 return T(2) *
pi<T>();
67template <
typename T =
float>
68[[nodiscard]]
constexpr T
toRad(T x = T(1)) noexcept {
69 static_assert(std::is_floating_point_v<T>,
"toRad requires a floating point argument.");
70 return x *
pi<T>() / T(180);
77template <
typename T =
float>
78[[nodiscard]]
constexpr T
toDeg(T x = T(1)) noexcept {
79 static_assert(std::is_floating_point_v<T>,
"toDeg requires a floating point argument.");
80 return x * T(180) /
pi<T>();
86template <
typename T =
float>
87[[nodiscard]]
constexpr T
toM(T x = T(1)) noexcept {
88 static_assert(std::is_floating_point_v<T>,
"toM requires a floating point argument.");
95template <
typename T =
float>
96[[nodiscard]]
constexpr T
toCm(T x = T(1)) noexcept {
97 static_assert(std::is_floating_point_v<T>,
"toCm requires a floating point argument.");
constexpr T toM(T x=T(1)) noexcept
Converts the given length x (in centimeters) to meters.
constexpr T Eps(T FloatEps=T(1e-7), T DoubleEps=T(1e-16))
Returns a type-appropriate tolerance/epsilon value.
constexpr T toDeg(T x=T(1)) noexcept
Converts the given angle x (in radians) to degrees.
constexpr T toCm(T x=T(1)) noexcept
Converts the given length x (in meters) to centimeters.
constexpr T ln2() noexcept
Returns the natural logarithm of 2 (log_e 2).
constexpr T nan() noexcept
Returns a quiet NaN value of type T.
constexpr T toRad(T x=T(1)) noexcept
Converts the given angle x (in degrees) to radians.
constexpr T twopi() noexcept
Returns 2 * pi.
constexpr T pi() noexcept
Returns the mathematical constant pi.