#include "portable.h"
#include "xbt/misc.h"
+#include "xbt/asserts.h"
#include "surf/datatypes.h"
#include <math.h>
+//#include <float.h>
/** @addtogroup SURF_lmm
extern double sg_maxmin_precision;
extern double sg_surf_precision;
-
+
static XBT_INLINE void double_update(double *variable, double value, double precision)
{
+ //printf("Updating %g -= %g +- %g\n",*variable,value,precision);
+ //xbt_assert(value==0 || value>precision);
+ //Check that precision is higher than the machine-dependent size of the mantissa. If not, brutal rounding may happen, and the precision mechanism is not active...
+ //xbt_assert(*variable< (2<<DBL_MANT_DIG)*precision && FLT_RADIX==2);
*variable -= value;
if (*variable < precision)
*variable = 0.0;
lmm_constraint_t cnst,
lmm_element_t * elem);
+/**
+ * @brief Get a var associated to a constraint
+ * @details Get the first variable of the next variable of elem if elem is not NULL
+ *
+ * @param sys The system associated to the variable (not used)
+ * @param cnst A constraint
+ * @param elem A element of constraint of the constraint or NULL
+ * @param nextelem A element of constraint of the constraint or NULL, the one after elem
+ * @param numelem parameter representing the number of elements to go
+ *
+ * @return A variable associated to a constraint
+ */
+XBT_PUBLIC(lmm_variable_t) lmm_get_var_from_cnst_safe(lmm_system_t /*sys*/,
+ lmm_constraint_t cnst,
+ lmm_element_t * elem,
+ lmm_element_t * nextelem,
+ int * numelem);
+
/**
* @brief Get the first active constraint of a system
*