Ranged integers
CIF can only represent integer numbers (type int
) in the range -2,147,483,648 (= -231) to 2,147,483,647 (= 231 - 1). Using values outside that range results in the CIF model being invalid, and leads to runtime errors:
ERROR: Integer overflow: 9999999 * 9999999.
It is possible in CIF to explicitly specify that only a sub range of the integer values are allowed:
disc int[3..7] x;
This variable x
can only have integer values that are at least 3
and at most 7
. Assigning any other value to x
is not allowed. The default value is not 0
but 3
, as that is the value closest to 0
that is in the allowed range of values.