mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -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.
|
||||
// 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;
|
||||
|
|
Loading…
Reference in a new issue