I recently received an "Invalid floating point operation" message when running a particular network under v2.2. I tracked the cause to the following line in the tanktimestep() function of hydraul.c:
// Find time to fill/drain tank
t = (long)ROUND(v / q);
My guess is that the value of (v / q) became too large to convert to an integer (a check already exists to not evaluate t if |q| < 1.0e-6).
The proposed fix is:
// Find time to fill/drain tank
double xt = v / q;
if (xt > *tstep + 1) continue;
t = (long)(ROUND(xt));
where *tstep is the current estimate of the next hydraulic time step which won't be any larger than the user-supplied time step. After making this fix the network in question ran successfully.
I recently received an "Invalid floating point operation" message when running a particular network under v2.2. I tracked the cause to the following line in the
tanktimestep()
function of hydraul.c:where the ROUND macro is defined in types.h as:
My guess is that the value of
(v / q)
became too large to convert to an integer (a check already exists to not evaluatet
if|q| < 1.0e-6
).The proposed fix is:
where
*tstep
is the current estimate of the next hydraulic time step which won't be any larger than the user-supplied time step. After making this fix the network in question ran successfully.