double-precision vensim dies with single-precision overflow
double-precision vensim dies with single-precision overflow
I'm doing an optimization with the double precision version of vensim, and it sometimes (not always) dies with "ERROR: The computed value (3.60256e+038) for - xyz - out of bounds. Truncated. ERROR: Floating point error preparing data for storage Trying to save results anyway." And it gets this single-precision overflow in the middle of a simulation. Why?
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
This is basically a floating point overflow but that shows up not as an overflow during computation but during the conversion of the result back to single precision. In general there can be some differences between single and double precision behavior. For example
normal number = (big number 1 * big number 2)/(big number 3 * big number 4)
might not cause any trouble in double precision, but generate a floating point exception in single precision. Your example is more like
too big number = big number 1 * big number 2
in single precision the multiplication causes the error. In double precision the multiplication is OK (double can handle bigger numbers) but the resulting number can't be stored as a result so the error message is thrown. The fix is the same for both - keep big number 1 and big number 2 smaller (or if a/b use ZIDZ or XIDZ).
normal number = (big number 1 * big number 2)/(big number 3 * big number 4)
might not cause any trouble in double precision, but generate a floating point exception in single precision. Your example is more like
too big number = big number 1 * big number 2
in single precision the multiplication causes the error. In double precision the multiplication is OK (double can handle bigger numbers) but the resulting number can't be stored as a result so the error message is thrown. The fix is the same for both - keep big number 1 and big number 2 smaller (or if a/b use ZIDZ or XIDZ).