Skip to content

Commit

Permalink
Clean up Numerical code a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
lehni committed Oct 2, 2015
1 parent f6f9d96 commit 00f1d50
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/util/Numerical.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ var Numerical = new function() {
* Numerical.EPSILON.
*/
isZero: function(val) {
return abs(val) <= EPSILON;
return val >= -EPSILON && val <= EPSILON;
},

/**
Expand Down Expand Up @@ -180,7 +180,7 @@ var Numerical = new function() {
*
* References:
* Kahan W. - "To Solve a Real Cubic Equation"
* http://www.cs.berkeley.edu/~wkahan/Math128/Cubic.pdf
* http://www.cs.berkeley.edu/~wkahan/Math128/Cubic.pdf
* Blinn J. - "How to solve a Quadratic Equation"
*
* @param {Number} a the quadratic term
Expand Down Expand Up @@ -212,8 +212,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)));
var mult = pow(10,
abs(Math.floor(Math.log(gmC) * Math.LOG10E)));
if (!isFinite(mult))
mult = 0;
a *= mult;
Expand Down

0 comments on commit 00f1d50

Please sign in to comment.