1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 00:47:45 +00:00

AK: Implement acos<T> correctly

This is a naive implementation based on the symmetry with `asin`.

Before, I'm not really sure what we were doing, but it was returning
wildly incorrect results.
This commit is contained in:
Jelle Raaijmakers 2021-11-18 16:16:57 +01:00 committed by Andreas Kling
parent 9ea5a00e24
commit dfbdd035da
2 changed files with 9 additions and 1 deletions

View file

@ -250,7 +250,7 @@ constexpr T acos(T value)
CONSTEXPR_STATE(acos, value);
// FIXME: I am naive
return Pi<T> + asin(value);
return static_cast<T>(0.5) * Pi<T> - asin<T>(value);
}
template<FloatingPoint T>