//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2010, 2026 Contributors to the Eclipse Foundation
//
// See the NOTICE file(s) distributed with this work for additional
// information regarding copyright ownership.
//
// This program and the accompanying materials are made available
// under the terms of the MIT License which is available at
// https://opensource.org/licenses/MIT
//
// SPDX-License-Identifier: MIT
//////////////////////////////////////////////////////////////////////////////

include::../_part_attributes.asciidoc[]

:leveloffset: -2

[[lang-tut-values-chapter-ranged-integers]]
== Ranged integers

indexterm:[integer,limits]
indexterm:[integer,overflow]
CIF can only represent <<lang-tut-values-chapter-integers,integer numbers>> (type `int`) in the range -2,147,483,648 (= -2^31^) to 2,147,483,647 (= 2^31^ - 1).
Using values outside that range results in the CIF model being invalid, and leads to runtime errors:

[source, console]
----
ERROR: Integer overflow: 9999999 * 9999999.
----

It is possible in CIF to explicitly specify that only a sub range of the integer values are allowed:

[source, cif]
----
disc int[3..7] x;
----

indexterm:[integer,range]
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.
