Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Unified Diff: test/unittests/base/ieee754-unittest.cc

Issue 2068743002: [builtins] Unify Atanh, Cbrt and Expm1 as exports from flibm. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed type warning. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/compiler/test-run-machops.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/base/ieee754-unittest.cc
diff --git a/test/unittests/base/ieee754-unittest.cc b/test/unittests/base/ieee754-unittest.cc
index 25ea26c9fae06e59955de96a80bd4a5cb0e338f4..5f98eff863fe099a116e6dc085599fbd39e10b9c 100644
--- a/test/unittests/base/ieee754-unittest.cc
+++ b/test/unittests/base/ieee754-unittest.cc
@@ -54,6 +54,15 @@ TEST(Ieee754, Atan2) {
-std::numeric_limits<double>::infinity()));
}
+TEST(Ieee754, Atanh) {
+ EXPECT_THAT(atanh(std::numeric_limits<double>::quiet_NaN()), IsNaN());
+ EXPECT_THAT(atanh(std::numeric_limits<double>::signaling_NaN()), IsNaN());
+ EXPECT_THAT(atanh(std::numeric_limits<double>::infinity()), IsNaN());
+ EXPECT_EQ(std::numeric_limits<double>::infinity(), atanh(1));
+ EXPECT_EQ(-std::numeric_limits<double>::infinity(), atanh(-1));
+ EXPECT_DOUBLE_EQ(0.54930614433405478, atanh(0.5));
+}
+
TEST(Ieee754, Exp) {
EXPECT_THAT(exp(std::numeric_limits<double>::quiet_NaN()), IsNaN());
EXPECT_THAT(exp(std::numeric_limits<double>::signaling_NaN()), IsNaN());
@@ -82,6 +91,20 @@ TEST(Ieee754, Exp) {
exp(std::numeric_limits<double>::infinity()));
}
+TEST(Ieee754, Expm1) {
+ EXPECT_THAT(expm1(std::numeric_limits<double>::quiet_NaN()), IsNaN());
+ EXPECT_THAT(expm1(std::numeric_limits<double>::signaling_NaN()), IsNaN());
+ EXPECT_EQ(-1.0, expm1(-std::numeric_limits<double>::infinity()));
+ EXPECT_EQ(std::numeric_limits<double>::infinity(),
+ expm1(std::numeric_limits<double>::infinity()));
+ EXPECT_EQ(0.0, expm1(-0.0));
+ EXPECT_EQ(0.0, expm1(0.0));
+ EXPECT_EQ(1.718281828459045, expm1(1.0));
+ EXPECT_EQ(2.6881171418161356e+43, expm1(100.0));
+ EXPECT_EQ(8.218407461554972e+307, expm1(709.0));
+ EXPECT_EQ(std::numeric_limits<double>::infinity(), expm1(710.0));
+}
+
TEST(Ieee754, Log) {
EXPECT_THAT(log(std::numeric_limits<double>::quiet_NaN()), IsNaN());
EXPECT_THAT(log(std::numeric_limits<double>::signaling_NaN()), IsNaN());
@@ -146,6 +169,18 @@ TEST(Ieee754, Log10) {
EXPECT_EQ(-0.9083828622192334, log10(0.12348583358871));
}
+TEST(Ieee754, cbrt) {
+ EXPECT_THAT(cbrt(std::numeric_limits<double>::quiet_NaN()), IsNaN());
+ EXPECT_THAT(cbrt(std::numeric_limits<double>::signaling_NaN()), IsNaN());
+ EXPECT_EQ(std::numeric_limits<double>::infinity(),
+ cbrt(std::numeric_limits<double>::infinity()));
+ EXPECT_EQ(-std::numeric_limits<double>::infinity(),
+ cbrt(-std::numeric_limits<double>::infinity()));
+ EXPECT_EQ(1.4422495703074083, cbrt(3));
+ EXPECT_EQ(100, cbrt(100 * 100 * 100));
+ EXPECT_EQ(46.415888336127786, cbrt(100000));
+}
+
} // namespace ieee754
} // namespace base
} // namespace v8
« no previous file with comments | « test/cctest/compiler/test-run-machops.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698