Index: src/math.js |
=================================================================== |
--- src/math.js (revision 3431) |
+++ src/math.js (working copy) |
@@ -128,8 +128,9 @@ |
var n = %_Arguments(i); |
if (!IS_NUMBER(n)) n = ToNumber(n); |
if (NUMBER_IS_NAN(n)) return n; |
- // Make sure +0 is considered greater than -0. |
- if (n > r || (r === 0 && n === 0 && !%_IsSmi(r))) r = n; |
+ // Make sure +0 is considered greater than -0. -0 is never a Smi, +0 can be |
+ // a Smi or heap number. |
+ if (n > r || (r === 0 && n === 0 && !%_IsSmi(r) && 1 / r < 0)) r = n; |
} |
return r; |
} |
@@ -147,8 +148,9 @@ |
var n = %_Arguments(i); |
if (!IS_NUMBER(n)) n = ToNumber(n); |
if (NUMBER_IS_NAN(n)) return n; |
- // Make sure -0 is considered less than +0. |
- if (n < r || (r === 0 && n === 0 && !%_IsSmi(n))) r = n; |
+ // Make sure -0 is considered less than +0. -0 is never a Smi, +0 can b a |
+ // Smi or a heap number. |
+ if (n < r || (r === 0 && n === 0 && !%_IsSmi(n) && 1 / n < 0)) r = n; |
} |
return r; |
} |