1
Fork 0
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:
Bastiaan van der Plaat 2023-09-09 14:43:39 +02:00 committed by Sam Atkins
parent 9b7aa8f6b6
commit 494a8cb816
15 changed files with 40 additions and 40 deletions

View file

@ -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>) \