maths: ensure float types for to_{radians,degrees}
This commit is contained in:
parent
8da9151df2
commit
eda46a9e7c
@ -181,6 +181,7 @@ template <typename T>
|
|||||||
constexpr T
|
constexpr T
|
||||||
to_degrees [[gnu::pure]] (T radians)
|
to_degrees [[gnu::pure]] (T radians)
|
||||||
{
|
{
|
||||||
|
static_assert (std::is_floating_point<T>::value, "undefined for integral types");
|
||||||
return radians * 180 / PI<T>;
|
return radians * 180 / PI<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,6 +190,7 @@ template <typename T>
|
|||||||
constexpr T
|
constexpr T
|
||||||
to_radians [[gnu::pure]] (T degrees)
|
to_radians [[gnu::pure]] (T degrees)
|
||||||
{
|
{
|
||||||
|
static_assert (std::is_floating_point<T>::value, "undefined for integral types");
|
||||||
return degrees / 180 * PI<T>;
|
return degrees / 180 * PI<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user