Integer

Navigation:  Language Reference > Types >

Integer

Previous pageReturn to chapter overviewNext page

Signed four-byte integer. It can hold any value between -2147483648 and +2147483647. Integer is the recommended data type for the control of program loops (e.g. in for-next loops) and element numbering.

Example

parameters

 integer i = 1,j = 2;

 real B[2,2] = [1,2;3,4]

 real b;

equations

 b = B[i,j];

 for i := 1 to 10 do ....end;

Limitations

When used in standard functions, integers are treated as reals. An equation like:

 

parameters

 integer c;

equations

 c = 10*sin(time);

 

would yield c equal to 0.8415. Try to avoid these constructions, since they lead to confusions. Us the round function instead:

 

parameters

 integer c;

equations

 c = round(10*sin(time));