Skip to content

Commit

Permalink
- _event_div_integer: check if value2 is zero before call ldiv
Browse files Browse the repository at this point in the history
- trunc for msvc

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14712 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Jan 8, 2013
1 parent 2ba0b38 commit d39091a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions SimulationRuntime/c/openmodelica.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ struct type_desc_s {
#define fmax(x, y) ((x>y)?x:y)
#define fmin(x, y) ((x<y)?x:y)
#define snprintf sprintf_s
#define trunc(a) ((double)((int)(a)))
#endif

/* Define _OMC_(s)random.*/
Expand Down
1 change: 1 addition & 0 deletions SimulationRuntime/c/simulation/solver/model_help.c
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,7 @@ modelica_integer _event_div_integer(modelica_integer x1, modelica_integer x2, mo
value1 = (modelica_integer)data->simulationInfo.mathEventsValuePre[index];
value2 = (modelica_integer)data->simulationInfo.mathEventsValuePre[index+1];
}
ASSERT1(value2 != 0,"event_div_integer failt at time %f because x2 is zero!",data->localData[0]->timeValue);
return ldiv(value1,value2).quot;
}

Expand Down

0 comments on commit d39091a

Please sign in to comment.