# Integer interval typesΒΆ

Integer interval types are special data types in CertSAFE that behave like a hybrid
between user-defined enumeration types and the built-in integer data types such
as `Int32`

and `UInt8`

. An integer interval type has a fixed minimum and maximum value, written in square brackets
like `[min..max]`

. So, for example, a variable whose data type is `[1..100]`

can only have values in the set
\(\{1, 2, 3, ..., 98, 99, 100\}\).

Like the primitive integer types, integer interval types can be used

- with polymorphic integer literals, in components such as the Literal and Inline Comparator;
- with equality relational operators such as
`A = B`

in the Comparator and Inline Comparator, and with the Transition component;- with ordering relational operators such as
`A < B`

in the Comparator and Inline Comparator;- with the Min/Max Value Selector component;
- as Switch and case table keys; and
- as both inputs and outputs of the Nearest Cast component.

Unlike the primitive integer types, integer interval types **cannot** be used

- with arithmetic operators such as addition or multiplication;
- with the Special Numeric Function component;
- with bitwise operators; or
- with the bitwise conversion components Copy Bits and Coerce.

If you need to perform any of the above operations on an interval-typed variable, the recommended approach is to convert the variable to a primitive integer type using the Nearest Cast component, perform the desired computation, and then convert back to the original data type using another Nearest Cast component. Values that are out of the range of the destination data type will be truncated by the Nearest Cast component to the closest available value.