From e725d728fc7d94745c408bc922c2f81af272d995 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 7fbdcd505..993a7795f 100644 --- a/src/spicelib/devices/res/restemp.c +++ b/src/spicelib/devices/res/restemp.c @@ -98,6 +98,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 */