diff options
author | Marco Biscaro <marcobiscaro2112@gmail.com> | 2021-04-18 01:05:04 -0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-04-18 21:41:17 +0200 |
commit | 7dc95721ee0087846d818fdc46b380ed888c1d0e (patch) | |
tree | 666789941bff4bc65238289a3a977977e315815f /Userland | |
parent | 24dcd99e4b3a0538e12c9975b03c9cbfb7ff226e (diff) | |
download | serenity-7dc95721ee0087846d818fdc46b380ed888c1d0e.zip |
Tests: Fix test-math expected values
Some of the expected values in test-math were wrong, which caused some
tests to fail.
The updated values were generated by Python's math library, and rounded
to 6 decimals places:
>>> import math
>>> round(math.exp(20.99), 6)
1305693298.670892
Examples of failure outputs:
FAIL: ../Userland/Tests/LibM/test-math.cpp:98:
EXPECT_APPROXIMATE(exp(v.x), v.exp) failed with
lhs=1305693298.670892, rhs=1304956710.432034, (lhs-rhs)=736588.238857
FAIL: ../Userland/Tests/LibM/test-math.cpp:99:
EXPECT_APPROXIMATE(sinh(v.x), v.sinh) failed with
lhs=652846649.335446, rhs=652478355.216017, (lhs-rhs)=368294.119428
FAIL: ../Userland/Tests/LibM/test-math.cpp:100:
EXPECT_APPROXIMATE(cosh(v.x), v.cosh) failed with
lhs=652846649.335446, rhs=652478355.216017, (lhs-rhs)=368294.119429
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Tests/LibM/test-math.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Userland/Tests/LibM/test-math.cpp b/Userland/Tests/LibM/test-math.cpp index e5b790e3ca..20867f5091 100644 --- a/Userland/Tests/LibM/test-math.cpp +++ b/Userland/Tests/LibM/test-math.cpp @@ -40,8 +40,8 @@ TEST_CASE(atan2) TEST_CASE(trig) { - EXPECT_APPROXIMATE(sin(1234), 0.601927); - EXPECT_APPROXIMATE(cos(1234), -0.798550); + EXPECT_APPROXIMATE(sin(1234), 0.601928); + EXPECT_APPROXIMATE(cos(1234), -0.798551); EXPECT_APPROXIMATE(tan(1234), -0.753775); EXPECT_APPROXIMATE(sqrt(1234), 35.128336); EXPECT_APPROXIMATE(sin(-1), -0.8414709848078965); @@ -58,8 +58,8 @@ TEST_CASE(trig) EXPECT_APPROXIMATE(asin(0.5), 0.523599); EXPECT_APPROXIMATE(asin(0.501), 0.524754); EXPECT_APPROXIMATE(asin(0.9), 1.119770); - EXPECT_APPROXIMATE(asin(0.99), 1.429245); - EXPECT_APPROXIMATE(asin(1.0), 1.570750); + EXPECT_APPROXIMATE(asin(0.99), 1.429257); + EXPECT_APPROXIMATE(asin(1.0), 1.570796); EXPECT_APPROXIMATE(atan(0), 0.0); EXPECT_APPROXIMATE(atan(0.5), 0.463648); EXPECT_APPROXIMATE(atan(-0.5), -0.463648); @@ -85,8 +85,8 @@ TEST_CASE(exponents) }; values values[8] { - { 1.500000, 4.481626, 2.129246, 2.352379, 0.905148 }, - { 20.990000, 1304956710.432035, 652478355.216017, 652478355.216017, 1.000000 }, + { 1.500000, 4.481689, 2.129279, 2.352410, 0.905148 }, + { 20.990000, 1305693298.670892, 652846649.335446, 652846649.335446, 1.000000 }, { 20.010000, 490041186.687082, 245020593.343541, 245020593.343541, 1.000000 }, { 0.000000, 1.000000, 0.000000, 1.000000, 0.000000 }, { 0.010000, 1.010050, 0.010000, 1.000050, 0.010000 }, @@ -107,13 +107,13 @@ TEST_CASE(logarithms) { EXPECT(isnan(log(-1))); EXPECT(log(0) < -1000000); - EXPECT_APPROXIMATE(log(0.5), -0.693233); + EXPECT_APPROXIMATE(log(0.5), -0.693147); EXPECT_APPROXIMATE(log(1.1), 0.095310); - EXPECT_APPROXIMATE(log(5), 1.609480); - EXPECT_APPROXIMATE(log(5.5), 1.704842); - EXPECT_APPROXIMATE(log(500), 6.214104); - EXPECT_APPROXIMATE(log2(5), 2.321989); - EXPECT_APPROXIMATE(log10(5), 0.698988); + EXPECT_APPROXIMATE(log(5), 1.609438); + EXPECT_APPROXIMATE(log(5.5), 1.704748); + EXPECT_APPROXIMATE(log(500), 6.214608); + EXPECT_APPROXIMATE(log2(5), 2.321928); + EXPECT_APPROXIMATE(log10(5), 0.698970); } union Extractor { |