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:
parent
801daf47f0
commit
dbc5b05b7a
2 changed files with 24 additions and 7 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue