1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +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

@ -259,3 +259,11 @@ TEST_CASE(fmax_and_fmin)
EXPECT(fmin(0, NAN) == 0);
EXPECT(isnan(fmin(NAN, NAN)));
}
TEST_CASE(acos)
{
EXPECT_APPROXIMATE(acos(-1), M_PI);
EXPECT_APPROXIMATE(acos(0), 0.5 * M_PI);
EXPECT_APPROXIMATE(acos(1), 0);
EXPECT(isnan(acos(1.1)));
}