Index: src/js/typedarray.js |
diff --git a/src/js/typedarray.js b/src/js/typedarray.js |
index 7becd8947a5a9161b1584d3f1e2bfd93a223d7d3..adb41ec0fb1fbdb12123937b60a45e8018a27d42 100644 |
--- a/src/js/typedarray.js |
+++ b/src/js/typedarray.js |
@@ -565,22 +565,20 @@ function TypedArrayReverse() { |
function TypedArrayComparefn(x, y) { |
- if (IsNaN(x) && IsNaN(y)) { |
- return IsNaN(y) ? 0 : 1; |
+ if (x === 0 && x === y) { |
+ x = 1 / x; |
+ y = 1 / y; |
} |
- if (IsNaN(x)) { |
+ if (x < y) { |
+ return -1; |
+ } else if (x > y) { |
+ return 1; |
+ } else if (IsNaN(x) && IsNaN(y)) { |
+ return IsNaN(y) ? 0 : 1; |
+ } else if (IsNaN(x)) { |
return 1; |
} |
- if (x === 0 && x === y) { |
- if (%_IsMinusZero(x)) { |
- if (!%_IsMinusZero(y)) { |
- return -1; |
- } |
- } else if (%_IsMinusZero(y)) { |
- return 1; |
- } |
- } |
- return x - y; |
+ return 0; |
} |