| Index: src/js/math.js
|
| diff --git a/src/js/math.js b/src/js/math.js
|
| index 8a84fdfd69f7ad32cfeaa0f1fb7a758b567fd09d..a698fd4285cac1adbc1396f84deab9ab6d29e97c 100644
|
| --- a/src/js/math.js
|
| +++ b/src/js/math.js
|
| @@ -164,17 +164,14 @@ function MathHypot(x, y) { // Function length is 2.
|
| // We may want to introduce fast paths for two arguments and when
|
| // normalization to avoid overflow is not necessary. For now, we
|
| // simply assume the general case.
|
| - var length = %_ArgumentsLength();
|
| - var args = new InternalArray(length);
|
| + var length = arguments.length;
|
| var max = 0;
|
| for (var i = 0; i < length; i++) {
|
| - var n = %_Arguments(i);
|
| - n = TO_NUMBER(n);
|
| - if (n === INFINITY || n === -INFINITY) return INFINITY;
|
| - n = MathAbs(n);
|
| + var n = MathAbs(arguments[i]);
|
| if (n > max) max = n;
|
| - args[i] = n;
|
| + arguments[i] = n;
|
| }
|
| + if (max === INFINITY) return INFINITY;
|
|
|
| // Kahan summation to avoid rounding errors.
|
| // Normalize the numbers to the largest one to avoid overflow.
|
| @@ -182,7 +179,7 @@ function MathHypot(x, y) { // Function length is 2.
|
| var sum = 0;
|
| var compensation = 0;
|
| for (var i = 0; i < length; i++) {
|
| - var n = args[i] / max;
|
| + var n = arguments[i] / max;
|
| var summand = n * n - compensation;
|
| var preliminary = sum + summand;
|
| compensation = (preliminary - sum) - summand;
|
|
|