Commit c49aa16f authored by yangguo@chromium.org's avatar yangguo@chromium.org

Slightly simplify Math.sign and Math.trunc.

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/504343005

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23440 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 31497a45
...@@ -173,8 +173,8 @@ function MathSign(x) { ...@@ -173,8 +173,8 @@ function MathSign(x) {
x = TO_NUMBER_INLINE(x); x = TO_NUMBER_INLINE(x);
if (x > 0) return 1; if (x > 0) return 1;
if (x < 0) return -1; if (x < 0) return -1;
if (x === 0) return x; // -0, 0 or NaN.
return NAN; return x;
} }
// ES6 draft 09-27-13, section 20.2.2.34. // ES6 draft 09-27-13, section 20.2.2.34.
...@@ -182,8 +182,8 @@ function MathTrunc(x) { ...@@ -182,8 +182,8 @@ function MathTrunc(x) {
x = TO_NUMBER_INLINE(x); x = TO_NUMBER_INLINE(x);
if (x > 0) return MathFloor(x); if (x > 0) return MathFloor(x);
if (x < 0) return MathCeil(x); if (x < 0) return MathCeil(x);
if (x === 0) return x; // -0, 0 or NaN.
return NAN; return x;
} }
// ES6 draft 09-27-13, section 20.2.2.30. // ES6 draft 09-27-13, section 20.2.2.30.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment