Index: src/harmony-math.js |
diff --git a/src/harmony-math.js b/src/harmony-math.js |
index 2e9b42a75e7cf368af023c29baaf9cd24663a3b8..a4d3f2e8a5e9c5936630571644605402dee1199d 100644 |
--- a/src/harmony-math.js |
+++ b/src/harmony-math.js |
@@ -29,7 +29,7 @@ |
// ES6 draft 09-27-13, section 20.2.2.28. |
function MathSign(x) { |
- if (!IS_NUMBER(x)) x = NonNumberToNumber(x); |
+ x = TO_NUMBER_INLINE(x); |
if (x > 0) return 1; |
if (x < 0) return -1; |
if (x === 0) return x; |
@@ -37,12 +37,23 @@ function MathSign(x) { |
} |
+// ES6 draft 09-27-13, section 20.2.2.34. |
+function MathTrunc(x) { |
+ x = TO_NUMBER_INLINE(x); |
+ if (x > 0) return MathFloor(x); |
+ if (x < 0) return MathCeil(x); |
+ if (x === 0) return x; |
+ return NAN; |
+} |
+ |
+ |
function ExtendMath() { |
%CheckIsBootstrapping(); |
// Set up the non-enumerable functions on the Math object. |
InstallFunctions($Math, DONT_ENUM, $Array( |
- "sign", MathSign |
+ "sign", MathSign, |
+ "trunc", MathTrunc |
)); |
} |