From 4fd120fab8e664a8d6748d10cb895d4a39a968da Mon Sep 17 00:00:00 2001 From: sapics Date: Tue, 21 Jun 2016 08:47:42 +0900 Subject: [PATCH] Minor optimization in Numerical.js --- src/util/Numerical.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/Numerical.js b/src/util/Numerical.js index bb3c4df0..9c339b89 100644 --- a/src/util/Numerical.js +++ b/src/util/Numerical.js @@ -255,7 +255,7 @@ var Numerical = new function() { if (D !== 0 && abs(D) < MACHINE_EPSILON) { // If the geometric mean of the coefficients is small enough var sc = (abs(a) + abs(b) + abs(c)) || MACHINE_EPSILON; - sc = pow(2, -Math.floor(Math.log(sc) / Math.log(2) + 0.5)); + sc = pow(2, -Math.floor(Math.log(sc) * Math.LOG2E + 0.5)); a *= sc; b *= sc; c *= sc; @@ -333,7 +333,7 @@ var Numerical = new function() { // Scale the coefficients by a multiple of the exponent of // coefficients so that all the bits in the mantissa are // preserved. - var p = pow(2, - Math.floor(Math.log(s) / Math.log(2))); + var p = pow(2, -Math.floor(Math.log(s) * Math.LOG2E)); a *= p; b *= p; c *= p;