From 3a014f570ee3205fa665e129fd814667fff362c6 Mon Sep 17 00:00:00 2001 From: rlar Date: Thu, 18 Jan 2018 18:01:25 +0100 Subject: [PATCH] res/restemp.c, avoid temporary NaN value, (simplify debugging) RESupdate_conduct() may be called several times before all parameters have been set via RESparam() invocations, or finally being set to default values in RESsetup() Especially RESscale might still be 0.0 as well as RESm thus temporarily creating a NaN in RESupdate_conduct. This would unnecessarily complicate debugging with enabled floating point exceptions. --- src/spicelib/devices/res/restemp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/spicelib/devices/res/restemp.c b/src/spicelib/devices/res/restemp.c index 0f9116557..cf1cc3120 100644 --- a/src/spicelib/devices/res/restemp.c +++ b/src/spicelib/devices/res/restemp.c @@ -128,6 +128,9 @@ RESupdate_conduct(RESinstance *here, bool spill_warnings) else factor = (((tc2 * difference) + tc1) * difference) + 1.0; + if (!here->RESscaleGiven) + here->RESscale = 1; + here->RESconduct = here->RESm / (here->RESresist * factor * here->RESscale); /* Paolo Nenzi: AC value */