Restrict the limit for exp function (linear growth when exponent
is larger than 14, commit [93a76d]) to the PSPICE compatibility mode.
This commit is contained in:
parent
8da2f3c16d
commit
e2cf397b6d
|
|
@ -5,6 +5,7 @@ Author: 1987 Wayne A. Christopher, U. C. Berkeley CAD Group
|
||||||
//#define TRACE
|
//#define TRACE
|
||||||
|
|
||||||
#include "ngspice/ngspice.h"
|
#include "ngspice/ngspice.h"
|
||||||
|
#include "ngspice/compatmode.h"
|
||||||
#include "ngspice/ifsim.h"
|
#include "ngspice/ifsim.h"
|
||||||
#include "ngspice/iferrmsg.h"
|
#include "ngspice/iferrmsg.h"
|
||||||
#include "ngspice/inpdefs.h"
|
#include "ngspice/inpdefs.h"
|
||||||
|
|
@ -448,11 +449,16 @@ static INPparseNode *PTdifferentiate(INPparseNode * p, int varnum)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PTF_EXP: /* u > EXPARGMAX -> EXPMAX, that is exp(EXPARGMAX), else exp(u) */
|
case PTF_EXP: /* u > EXPARGMAX -> EXPMAX, that is exp(EXPARGMAX), else exp(u) */
|
||||||
arg1 = mkb(PT_TERN,
|
if (newcompat.ps) {
|
||||||
mkf(PTF_GT0, mkb(PT_MINUS, p->left, mkcon(EXPARGMAX))),
|
arg1 = mkb(PT_TERN,
|
||||||
mkb(PT_COMMA,
|
mkf(PTF_GT0, mkb(PT_MINUS, p->left, mkcon(EXPARGMAX))),
|
||||||
mkcon(EXPMAX),
|
mkb(PT_COMMA,
|
||||||
mkf(PTF_EXP, p->left)));
|
mkcon(EXPMAX),
|
||||||
|
mkf(PTF_EXP, p->left)));
|
||||||
|
}
|
||||||
|
else { /* exp(u) */
|
||||||
|
arg1 = mkf(PTF_EXP, p->left);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef TRACE1
|
#ifdef TRACE1
|
||||||
printf("debug exp, %s, returns; ", __func__);
|
printf("debug exp, %s, returns; ", __func__);
|
||||||
|
|
|
||||||
|
|
@ -215,11 +215,12 @@ PTcosh(double arg)
|
||||||
return (cosh(arg));
|
return (cosh(arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Limit the exp: If arg > EXPARGMAX (arbitrarily selected to 14), continue with linear output */
|
/* Limit the exp: If arg > EXPARGMAX (arbitrarily selected to 14), continue with linear output,
|
||||||
|
if compatmode PSPICE is selected*/
|
||||||
double
|
double
|
||||||
PTexp(double arg)
|
PTexp(double arg)
|
||||||
{
|
{
|
||||||
if (arg > EXPARGMAX)
|
if (newcompat.ps && arg > EXPARGMAX)
|
||||||
return EXPMAX * (arg - EXPARGMAX + 1.);
|
return EXPMAX * (arg - EXPARGMAX + 1.);
|
||||||
else
|
else
|
||||||
return (exp(arg));
|
return (exp(arg));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue