question

Jeremy R avatar image
0 Likes"
Jeremy R asked Jeremy R commented

Max/min values of int

In one particular application, I would like to check the value I want to assign to ensure if falls within the appropriate range for an int, so that it doesn't over or underflow.

While I can see that these values are defined in the documentation (-2147483647 and 2147483647), is there a better way to obtain this value in my code than hardcoding it (or defining it in a global macro)? For example, is there some function like int.max that will return the maximum value an int can hold (such that if the max/min values were to change in a later version of FlexSim, these would contain the new values)?

FlexSim 18.2.0
int
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Joerg Vogel avatar image
1 Like"
Joerg Vogel answered Jeremy R commented

INT_MAX is a global fsmacro. You can look yourself in the main tree

project + exec + globals + fsmacros

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jeremy R avatar image Jeremy R commented ·

Thanks, this is what I was looking for!

0 Likes 0 ·