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

LibM: Use fptan/fpatan instead of approximating atan2/tan

The previous versions were very inaccurate, and sometimes wrong.
This commit is contained in:
AnotherTest 2021-04-15 18:42:41 +04:30 committed by Andreas Kling
parent 801daf47f0
commit dbc5b05b7a
2 changed files with 24 additions and 7 deletions

View file

@ -29,6 +29,15 @@
#include <float.h>
#include <math.h>
TEST_CASE(atan2)
{
EXPECT_APPROXIMATE(atan2(-1, -0.0e0), -M_PI_2);
EXPECT_APPROXIMATE(atan2(-0.0e0, -1), -M_PI);
EXPECT_APPROXIMATE(atan2(0.0e0, -1), M_PI);
EXPECT_APPROXIMATE(atan2(-0.0e0, 1), -0.0e0);
EXPECT_APPROXIMATE(atan2(0.0e0, 1), 0.0e0);
}
TEST_CASE(trig)
{
EXPECT_APPROXIMATE(sin(1234), 0.601927);