mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:57:45 +00:00
AK: Add to_radians and to_degrees math functions
This commit is contained in:
parent
9b7aa8f6b6
commit
494a8cb816
15 changed files with 40 additions and 40 deletions
12
AK/Math.h
12
AK/Math.h
|
@ -53,6 +53,18 @@ template<size_t value>
|
|||
constexpr size_t product_odd() { return value * product_odd<value - 2>(); }
|
||||
}
|
||||
|
||||
template<FloatingPoint T>
|
||||
constexpr T to_radians(T degrees)
|
||||
{
|
||||
return degrees * AK::Pi<T> / 180;
|
||||
}
|
||||
|
||||
template<FloatingPoint T>
|
||||
constexpr T to_degrees(T radians)
|
||||
{
|
||||
return radians * 180 / AK::Pi<T>;
|
||||
}
|
||||
|
||||
#define CONSTEXPR_STATE(function, args...) \
|
||||
if (is_constant_evaluated()) { \
|
||||
if (IsSame<T, long double>) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue