Revision: 23440
Author:   [email protected]
Date:     Wed Aug 27 09:49:38 2014 UTC
Log:      Slightly simplify Math.sign and Math.trunc.

[email protected]

Review URL: https://codereview.chromium.org/504343005
https://code.google.com/p/v8/source/detail?r=23440

Modified:
 /branches/bleeding_edge/src/math.js

=======================================
--- /branches/bleeding_edge/src/math.js Wed Aug 20 14:24:07 2014 UTC
+++ /branches/bleeding_edge/src/math.js Wed Aug 27 09:49:38 2014 UTC
@@ -173,8 +173,8 @@
   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 @@
   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.

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to