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

Unified Diff: src/harmony-math.js

Issue 163563003: Harmony: implement Math.cbrt, Math.expm1 and Math.log1p. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 6 years, 10 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 | « no previous file | src/runtime.h » ('j') | src/runtime.cc » ('J')
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 ee426ef1191f417b2178b17581c1a516704ecaab..7fb1ba0df6367e228e0ebdaa6d3abd3c83121459 100644
--- a/src/harmony-math.js
+++ b/src/harmony-math.js
@@ -154,6 +154,26 @@ function MathHypot(x, y) { // Function length is 2.
}
+//ES6 draft 09-27-13, section 20.2.2.9.
+function MathCbrt(x) {
+ if (!IS_NUMBER(x)) x = NonNumberToNumber(x);
+ if (x === 0 || !NUMBER_IS_FINITE(x)) return x;
Jarin 2014/02/18 14:08:53 Is there any reason why you check for the corner c
+ return %Math_cbrt(x);
+}
+
+
+//ES6 draft 09-27-13, section 20.2.2.14.
+function MathExpm1(x) {
+ return %Math_expm1(TO_NUMBER_INLINE(x));
+}
+
+
+//ES6 draft 09-27-13, section 20.2.2.20.
+function MathLog1p(x) {
+ return %Math_log1p(TO_NUMBER_INLINE(x));
+}
+
+
function ExtendMath() {
%CheckIsBootstrapping();
@@ -169,7 +189,10 @@ function ExtendMath() {
"atanh", MathAtanh,
"log10", MathLog10,
"log2", MathLog2,
- "hypot", MathHypot
+ "hypot", MathHypot,
+ "cbrt", MathCbrt,
+ "log1p", MathLog1p,
+ "expm1", MathExpm1
));
}
« no previous file with comments | « no previous file | src/runtime.h » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698