From af351eab5f35b968fc6f95c71f96c125b318b1f7 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 18 May 2018 16:55:31 +0200 Subject: [PATCH] add a non-zero fudge factor to zero function argument --- src/spicelib/parser/ptfuncs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/spicelib/parser/ptfuncs.c b/src/spicelib/parser/ptfuncs.c index 119cc22ef..fe81d5c57 100644 --- a/src/spicelib/parser/ptfuncs.c +++ b/src/spicelib/parser/ptfuncs.c @@ -14,6 +14,7 @@ Author: 1987 Wayne A. Christopher, U. C. Berkeley CAD Group #include "ngspice/ifsim.h" #include "ngspice/inpptree.h" #include "inpxx.h" +#include "ngspice/compatmode.h" /* XXX These should be in math.h */ @@ -82,6 +83,10 @@ PTpower(double arg1, double arg2) double PTpwr(double arg1, double arg2) { + /* if PSPICE device is evaluated */ + if (arg1 == 0.0 && arg2 < 0.0 && inp_compat_mode == COMPATMODE_PS) + arg1 += PTfudge_factor; + if (arg1 < 0.0) return (-pow(-arg1, arg2)); else