From 740670805e6df9c32fbf5a1226f0d14c98a1a9e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81rp=C3=A1d=20B=C5=B1rmen?= Date: Fri, 12 Sep 2025 10:10:48 +0200 Subject: [PATCH] Check if toxp+dtox!=toxe with double precision tolerance. --- src/spicelib/devices/bsim4/b4temp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/spicelib/devices/bsim4/b4temp.c b/src/spicelib/devices/bsim4/b4temp.c index 3b41db563..f4c76dd65 100644 --- a/src/spicelib/devices/bsim4/b4temp.c +++ b/src/spicelib/devices/bsim4/b4temp.c @@ -122,8 +122,12 @@ int Fatal_Flag = 0; if(model->BSIM4mtrlMod == 0) { + double chktol = fabs(model->BSIM4toxe); + if (fabs(model->BSIM4toxp)>chktol) chktol = fabs(model->BSIM4toxp); + if (fabs(model->BSIM4dtox)>chktol) chktol = fabs(model->BSIM4dtox); + chktol=chktol*1e-14; if ((model->BSIM4toxeGiven) && (model->BSIM4toxpGiven) && (model->BSIM4dtoxGiven) - && (model->BSIM4toxe != (model->BSIM4toxp + model->BSIM4dtox))) + && (fabs(model->BSIM4toxe-(model->BSIM4toxp + model->BSIM4dtox))>chktol)) { printf("Warning: toxe, toxp and dtox all given and toxe != toxp + dtox; dtox ignored.\n"); } else if ((model->BSIM4toxeGiven) && (!model->BSIM4toxpGiven))