Skip to content

Commit 6e671d8

Browse files
authored
Update Algebra.js
1 parent a0afaed commit 6e671d8

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

Algebra.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,14 @@ if((typeof module) !== 'undefined') {
419419
}
420420
return false;
421421
};
422+
Symbol.prototype.hasConstant = function() {
423+
if(this.group === CP) {
424+
for(var x in this.symbols) {
425+
if(this.symbols[x].isConstant()) return true;
426+
}
427+
}
428+
return false;
429+
};
422430
core.Utils.subFunctions = function(symbol, map) {
423431
map = map || {};
424432
var subbed = [];
@@ -1663,13 +1671,12 @@ if((typeof module) !== 'undefined') {
16631671
var first_div_term = selected[0];
16641672

16651673
var q = _.divide(first_div_term[1].clone(), first_div_term[0].clone());
1666-
/*
1674+
16671675
//no need to start dipping into the divisor again.
1668-
if(q.isConstant() && remainder.equals(0) && !quotient.equals(0)) {
1676+
if(q.isConstant() && selected.length === 1 && !quotient.hasConstant()) {
16691677
remainder = ndividend;
16701678
break;
16711679
}
1672-
*/
16731680

16741681
if(sl < divisor.length) {
16751682
var idx = first_div_term[2];

0 commit comments

Comments
 (0)