In some cases, after subs'ing in basis and exponent, an extra
substitution was performed. This could lead to messed-up final results
because, e.g. substituting x==1/x in 1/x evaluated to x, but then
another substitution x==1/x was performed.
Reported by Feng Feng <f.feng@outlook.com>.
++result;
}
+ // This used to fail in GiNaC 1.8.2 with subs_options::no_pattern
+ e1 = 1/x;
+ e2 = e1.subs(x == 1/x);
+ if (!e2.is_equal(x)) {
+ clog << "(1/x).subs(x==1/x) erroneously returned " << e2 << " instead of x" << endl;
+ ++result;
+ }
+ e2 = e1.subs(x == 1/x, subs_options::no_pattern);
+ if (!e2.is_equal(x)) {
+ clog << "(1/x).subs(x==1/x, subs_options::no_pattern) erroneously returned " << e2 << " instead of x" << endl;
+ ++result;
+ }
+ e2 = e1.subs(x == 1/x, subs_options::algebraic);
+ if (!e2.is_equal(x)) {
+ clog << "(1/x).subs(x==1/x, subs_options::algebraic) erroneously returned " << e2 << " instead of x" << endl;
+ ++result;
+ }
+
return result;
}
if (!are_ex_trivially_equal(basis, subsed_basis)
|| !are_ex_trivially_equal(exponent, subsed_exponent))
- return power(subsed_basis, subsed_exponent).subs_one_level(m, options);
+ return dynallocate<power>(subsed_basis, subsed_exponent);
if (!(options & subs_options::algebraic))
return subs_one_level(m, options);