Make Numerical.solveQuadratic() optimizable for Chrome V8

Little change to help Chrome's V( optimize `Numerical.solveQuadratic()`. In my use case this resulted in an overall performance improvement of about 1.5%. For details see #1078
This commit is contained in:
Jan 2016-06-15 14:53:28 +02:00 committed by GitHub
parent 383e574368
commit 262b9b388d

View file

@ -234,10 +234,8 @@ var Numerical = new function() {
// We multiply with a factor to normalize the coefficients.
// The factor is just the nearest exponent of 10, big enough
// to raise all the coefficients to nearly [-1, +1] range.
var mult = pow(10,
abs(Math.floor(Math.log(gmC) * Math.LOG10E)));
if (!isFinite(mult))
mult = 0;
var mult = gmC === 0 ? 0 : pow(10,
abs(Math.floor(Math.log(gmC) * Math.LOG10E)));
a *= mult;
b *= mult;
c *= mult;