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

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

Issue 2063693002: [builtins] Introduce proper Float64Log2 and Float64Log10 operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: More precise log10. 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 bfe2082e8a4a9bb258a900fd4488e43fd626caa1..8ee69ec2661dad0c5b5c991a90a8863a642def45 100644
--- a/test/unittests/base/ieee754-unittest.cc
+++ b/test/unittests/base/ieee754-unittest.cc
@@ -91,6 +91,33 @@ TEST(Ieee754, Log1p) {
EXPECT_EQ(0.8109302162163288, log1p(1.25));
}
+TEST(Ieee754, Log2) {
+ EXPECT_THAT(log2(std::numeric_limits<double>::quiet_NaN()), IsNaN());
+ EXPECT_THAT(log2(std::numeric_limits<double>::signaling_NaN()), IsNaN());
+ EXPECT_THAT(log2(-std::numeric_limits<double>::infinity()), IsNaN());
+ EXPECT_THAT(log2(-1.0), IsNaN());
+ EXPECT_EQ(-std::numeric_limits<double>::infinity(), log2(0.0));
+ EXPECT_EQ(-std::numeric_limits<double>::infinity(), log2(-0.0));
+ EXPECT_EQ(std::numeric_limits<double>::infinity(),
+ log2(std::numeric_limits<double>::infinity()));
+}
+
+TEST(Ieee754, Log10) {
+ EXPECT_THAT(log10(std::numeric_limits<double>::quiet_NaN()), IsNaN());
+ EXPECT_THAT(log10(std::numeric_limits<double>::signaling_NaN()), IsNaN());
+ EXPECT_THAT(log10(-std::numeric_limits<double>::infinity()), IsNaN());
+ EXPECT_THAT(log10(-1.0), IsNaN());
+ EXPECT_EQ(-std::numeric_limits<double>::infinity(), log10(0.0));
+ EXPECT_EQ(-std::numeric_limits<double>::infinity(), log10(-0.0));
+ EXPECT_EQ(std::numeric_limits<double>::infinity(),
+ log10(std::numeric_limits<double>::infinity()));
+ EXPECT_EQ(3.0, log10(1000.0));
+ EXPECT_EQ(14.0, log10(100000000000000)); // log10(10 ^ 14)
+ EXPECT_EQ(3.7389561269540406, log10(5482.2158));
+ EXPECT_EQ(14.661551142893833, log10(458723662312872.125782332587));
+ EXPECT_EQ(-0.9083828622192334, log10(0.12348583358871));
+}
+
} // 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