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.
This commit is contained in:
rlar 2018-01-18 18:01:25 +01:00
parent ead6dc4816
commit e725d728fc
1 changed files with 3 additions and 0 deletions

View File

@ -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 */