From: alegrand Date: Mon, 13 Aug 2007 15:27:06 +0000 (+0000) Subject: Take into account the weird case where remain would already be 0 (could happen if... X-Git-Tag: v3.3~1285 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e133b2408a0507b0f4f352dc64cabecdc2f1c98b Take into account the weird case where remain would already be 0 (could happen if a 0-size action is created) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@4075 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/surf/surf.c b/src/surf/surf.c index 346c22e97f..4d65ff397f 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -219,7 +219,10 @@ double generic_maxmin_share_resources2(xbt_swag_t running_actions, return -1.0; if (value > 0) { - min = action->remains / value; + if(action->remains>0) + min = action->remains / value; + else + min = 0.0; if ((action->max_duration >= 0) && (action->max_duration < min)) min = action->max_duration; } else @@ -233,7 +236,10 @@ double generic_maxmin_share_resources2(xbt_swag_t running_actions, action = xbt_swag_getNext(action, running_actions->offset)) { value = lmm_variable_getvalue(VARIABLE(action)); if (value > 0) { - value = action->remains / value; + if(action->remains>0) + value = action->remains / value; + else + value = 0.0; if (value < min) { min = value; DEBUG2("Updating min (value) with %p: %f", action, min);