When an expair turns out to represent a number, that should go into
the expairseq's overall_coeff. This was accomplished by class mul,
thanks to the override of expair_needs_further_processing(), but not
always for class add.
This patch fixes the base class' expair_needs_further_processing()
with similar logic as that already in place for class mul.
Thanks to Mario Prausa for reporting this.
return result;
}
+// Bug in add ctor
+unsigned exam_paranoia25()
+{
+ symbol a("a"), b("b"), c("c");
+ ex e = -a + 2*b + c;
+
+ if (e.diff(c).nops() > 1) {
+ clog << "diff(" << e << ",c) was not fully evaluated.\n";
+ return 1;
+ }
+ return 0;
+}
+
unsigned exam_paranoia()
{
unsigned result = 0;
result += exam_paranoia22(); cout << '.' << flush;
result += exam_paranoia23(); cout << '.' << flush;
result += exam_paranoia24(); cout << '.' << flush;
+ result += exam_paranoia25(); cout << '.' << flush;
return result;
}
bool expairseq::expair_needs_further_processing(epp it)
{
+ if (is_exactly_a<numeric>(it->rest) &&
+ it->coeff.is_equal(_ex1)) {
+ // the pair {<n>, 1} has yet to be absorbed into overall_coeff
+ return true;
+ }
return false;
}