An integer format is a data type in computer programming. Data is typed by the kind of information that is being stored, to what accuracy numeric data is stored, and how that information is to be manipulated in processing. Integers represent whole units. Integers occupy less space in memory, but this space-saving feature limits the magnitude of the integer that can be stored.
Integers are whole numbers used in arithmetic, algebra, accounting and enumeration applications. A whole number implies there are no smaller partial units. The number 2 as an integer has a different meaning that the number 2.0. The second format indicates that there are two whole units and zero tenths of a unit but that tenths of a unit are possible. The first number, as an integer, implies that smaller units are not considered.
There are two reasons for an integer format in programming languages. First, an integer format is appropriate when considering objects that are not divisible into smaller units. A manager writing a computer program to calculate the division of a $100 bonus between three employees, would not assign an integer format to the bonus variable but would use one to store the number of employees. Programmers recognized that integers are whole numbers and do not require as many digits to be accurately represented.
In the early days of computing, memory space was limited and precious, and an integer format was developed to save memory. As computer memory is a binary system, numbers were represented in base 2, meaning acceptable digits are 0 and 1. The number 10 in base 2 represents the number 2 in base 10, as the 1 in the two’s column is the digit multiplied by 2 raised to the second power. 100 in base 2 equals 8 in base 10, as the 1 in the first column is 1 multiplied by 2 cubed.
Using an on/off basis for representing binary numbers, electrically based computers were developed. A bit is a single on/off, true/false, or 0/1 representation of data. While different hardware configurations were explored using variations of the number of bits that are directly addressable by the computer, the 8-bit byte and the 2-byte word became standard for general use computing. Then the specification of the integer format width determines not the number of decimal places but the largest and smallest value an integer may assume.
Most languages’ integer formats allow a bit to be used for a sign to a designate a positive or negative integer. On a 32-bit language compiler, the C/C+ languages uses the integer format, int, to store signed integer values between –231 to 231-1. One integer value is subtracted to accommodate the zero, or roughly +/- 2.1 trillion. On a 64-bit compiler, using the int64 data type, signed integer values between -263 to 263-1, or +/- 9.2 quintillion, are allowed.