Merge commit '6e92ecf9efab80668453622bc42226616043320e'

This commit is contained in:
Scott R Charlton 2018-11-07 15:29:50 -07:00
commit c1c6ca18a8

View File

@ -1108,15 +1108,14 @@ init_mix(void)
} }
else else
{ {
const int max_int = (int) (std::numeric_limits<int>::max)(); if (2.25 * maxmix + 1.0 > (double)INT_MAX)
if ((int)round(2.25 * maxmix) > max_int)
{ {
char token[MAX_LENGTH]; char token[MAX_LENGTH];
sprintf(token, "Calculated number of mixes %g, is beyond program limit,\nERROR: please decrease time_step.", 2.25 * maxmix); sprintf(token, "Calculated number of mixes %g, is beyond program limit,\nERROR: please decrease time_step.", 2.25 * maxmix);
error_msg(token, STOP); error_msg(token, STOP);
} }
if (bcon_first == 1 || bcon_last == 1) if (bcon_first == 1 || bcon_last == 1)
l_nmix = 1 + (long int) floorl(2.25 * maxmix); l_nmix = 1 + (int) floor(2.25 * maxmix);
else else
l_nmix = 1 + (int) floor(1.5 * maxmix); l_nmix = 1 + (int) floor(1.5 * maxmix);