mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
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:
parent
383e574368
commit
262b9b388d
1 changed files with 2 additions and 4 deletions
|
@ -234,10 +234,8 @@ var Numerical = new function() {
|
||||||
// We multiply with a factor to normalize the coefficients.
|
// We multiply with a factor to normalize the coefficients.
|
||||||
// The factor is just the nearest exponent of 10, big enough
|
// The factor is just the nearest exponent of 10, big enough
|
||||||
// to raise all the coefficients to nearly [-1, +1] range.
|
// to raise all the coefficients to nearly [-1, +1] range.
|
||||||
var mult = pow(10,
|
var mult = gmC === 0 ? 0 : pow(10,
|
||||||
abs(Math.floor(Math.log(gmC) * Math.LOG10E)));
|
abs(Math.floor(Math.log(gmC) * Math.LOG10E)));
|
||||||
if (!isFinite(mult))
|
|
||||||
mult = 0;
|
|
||||||
a *= mult;
|
a *= mult;
|
||||||
b *= mult;
|
b *= mult;
|
||||||
c *= mult;
|
c *= mult;
|
||||||
|
|
Loading…
Reference in a new issue