Clean up Numerical code a bit.

This commit is contained in:
Jürg Lehni 2015-10-02 18:56:41 -05:00
parent f6f9d963eb
commit 00f1d5089f

View file

@ -121,7 +121,7 @@ var Numerical = new function() {
* Numerical.EPSILON.
*/
isZero: function(val) {
return abs(val) <= EPSILON;
return val >= -EPSILON && val <= EPSILON;
},
/**
@ -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;