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

Unified Diff: src/harmony-math.js

Issue 119093006: Harmony: implement Math.log2 and Math.log10. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 | « no previous file | test/mjsunit/harmony/math-log2-log10.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/harmony-math.js
diff --git a/src/harmony-math.js b/src/harmony-math.js
index 2bf33d63f2c81b26263abffea9e931bb9a60008e..652e8aeb75db1757327a3044974a3ed79da48029 100644
--- a/src/harmony-math.js
+++ b/src/harmony-math.js
@@ -110,6 +110,18 @@ function MathAtanh(x) {
}
+//ES6 draft 09-27-13, section 20.2.2.21.
+function MathLog10(x) {
+ return MathLog(x) * 0.434294481903251828; // log10(x) = log(x)/log(10).
+}
+
+
+//ES6 draft 09-27-13, section 20.2.2.22.
+function MathLog2(x) {
+ return MathLog(x) * 1.442695040888963407; // log2(x) = log(x)/log(2).
+}
+
+
function ExtendMath() {
%CheckIsBootstrapping();
@@ -122,7 +134,9 @@ function ExtendMath() {
"tanh", MathTanh,
"asinh", MathAsinh,
"acosh", MathAcosh,
- "atanh", MathAtanh
+ "atanh", MathAtanh,
+ "log10", MathLog10,
+ "log2", MathLog2
));
}
« no previous file with comments | « no previous file | test/mjsunit/harmony/math-log2-log10.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698