From f78a8b49a7082585616d539d889366db97880775 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 14 Oct 2022 14:54:30 +0200 Subject: [PATCH] The derivative of pow shall use the new pow function as well, when compat mode LT is selected. --- src/spicelib/parser/inpptree.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/spicelib/parser/inpptree.c b/src/spicelib/parser/inpptree.c index ad3cbd489..ea9cb3cac 100644 --- a/src/spicelib/parser/inpptree.c +++ b/src/spicelib/parser/inpptree.c @@ -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);