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

Unified Diff: src/math.js

Issue 504343005: Slightly simplify Math.sign and Math.trunc. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/math.js
diff --git a/src/math.js b/src/math.js
index 00a507a28e5514d0ebdfcb81acc194821e443a98..7ead7a861efe20c82dcb70c736ee1ee82305bc21 100644
--- a/src/math.js
+++ b/src/math.js
@@ -173,8 +173,8 @@ function MathSign(x) {
x = TO_NUMBER_INLINE(x);
if (x > 0) return 1;
if (x < 0) return -1;
- if (x === 0) return x;
- return NAN;
+ // -0, 0 or NaN.
+ return x;
}
// ES6 draft 09-27-13, section 20.2.2.34.
@@ -182,8 +182,8 @@ 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;
+ // -0, 0 or NaN.
+ return x;
}
// ES6 draft 09-27-13, section 20.2.2.30.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698