The derivative of pow shall use the new pow function as well,

when compat mode LT is selected.
This commit is contained in:
Holger Vogt 2022-10-14 14:54:30 +02:00
parent 2378302114
commit f78a8b49a7
1 changed files with 16 additions and 6 deletions

View File

@ -331,12 +331,22 @@ static INPparseNode *PTdifferentiate(INPparseNode * p, int varnum)
#define b p->right
if (b->type == PT_CONSTANT) {
arg1 = PTdifferentiate(a, varnum);
newp = mkb(PT_TIMES,
mkb(PT_TIMES,
mkcon(b->constant),
mkf(PTF_PWR,
mkb(PT_COMMA, a, mkcon(b->constant - 1.0)))),
arg1);
if (newcompat.lt) {
newp = mkb(PT_TIMES,
mkb(PT_TIMES,
mkcon(b->constant),
mkf(PTF_POW,
mkb(PT_COMMA, a, mkcon(b->constant - 1.0)))),
arg1);
}
else {
newp = mkb(PT_TIMES,
mkb(PT_TIMES,
mkcon(b->constant),
mkf(PTF_PWR,
mkb(PT_COMMA, a, mkcon(b->constant - 1.0)))),
arg1);
}
}
else if (a->type == PT_CONSTANT){
arg2 = PTdifferentiate(b, varnum);