maths: add float overload of to_radians
This commit is contained in:
parent
a691f3b748
commit
f309c5dbd0
@ -154,6 +154,13 @@ to_degrees (double radians) {
|
||||
return radians * 180 / PI;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
constexpr float
|
||||
to_radians (float degrees) {
|
||||
return degrees / 180 * static_cast<float> (PI);
|
||||
}
|
||||
|
||||
|
||||
constexpr double
|
||||
to_radians (double degrees) {
|
||||
return degrees / 180 * PI;
|
||||
|
@ -40,7 +40,8 @@ main (int, char **) {
|
||||
CHECK_EQ (sign (-numeric_limits<double>::infinity ()), -1);
|
||||
|
||||
CHECK_EQ (to_degrees (PI), 180);
|
||||
CHECK_EQ (to_radians (180), PI);
|
||||
CHECK_EQ (to_radians (180.f), PI);
|
||||
CHECK_EQ (to_radians (180.0), PI);
|
||||
|
||||
CHECK_EQ (log2 (8u), 3);
|
||||
CHECK_EQ (log2 (1u), 0);
|
||||
|
Loading…
Reference in New Issue
Block a user