Different
CPUs support different integral data types. Typically, hardware will support both signed and unsigned types, but only a small, fixed set of widths. The table above lists integral type widths that are supported in hardware by common processors. High-level programming languages provide more possibilities. It is common to have a 'double width' integral type that has twice as many bits as the biggest hardware-supported type. Many languages also have
bit-field types (a specified number of bits, usually constrained to be less than the maximum hardware-supported width) and
range types (that can represent only the integers in a specified range). Some languages, such as
Lisp,
Smalltalk,
REXX,
Haskell,
Python, and
Raku, support
arbitrary precision integers (also known as
infinite precision integers or
bignums). Other languages that do not support this concept as a top-level construct may have libraries available to represent very large numbers using arrays of smaller variables, such as Java's class or
Perl's "bigint" package. These use as much of the computer's memory as is necessary to store the numbers; however, a computer has only a finite amount of storage, so they, too, can only represent a finite subset of the mathematical integers. These schemes support very large numbers; for example one kilobyte of memory could be used to store numbers up to 2466 decimal digits long. A
Boolean type is a type that can represent only two values: 0 and 1, usually identified with
false and
true respectively. This type can be stored in memory using a single bit, but is often given a full byte for convenience of addressing and speed of access. A four-bit quantity is known as a
nibble (when eating, being smaller than a
bite) or
nybble (being a pun on the form of the word
byte). One nibble corresponds to one digit in
hexadecimal and holds one digit or a sign code in binary-coded decimal.
Bytes and octets The term
byte initially meant 'the smallest addressable unit of memory'. In the past, 5-, 6-, 7-, 8-, and 9-bit bytes have all been used. There have also been computers that could address individual bits ('bit-addressed machine'), or that could only address 16- or 32-bit quantities ('word-addressed machine'). The term
byte was usually not used at all in connection with bit- and word-addressed machines. The term
octet always refers to an 8-bit quantity. It is mostly used in the field of
computer networking, where computers with different byte widths might have to communicate. In modern usage
byte almost invariably means eight bits, since all other sizes have fallen into disuse; thus
byte has come to be synonymous with
octet.
Words The term 'word' is used for a small group of bits that are handled simultaneously by processors of a particular
architecture. The size of a word is thus CPU-specific. Many different word sizes have been used, including 6, 8, 12, 16, 18, 24, 32, 36, 39, 40, 48, 60, and 64 bits. Since it is architectural, the size of a
word is usually set by the first CPU in a family, rather than the characteristics of a later compatible CPU. The meanings of terms derived from
word, such as
longword,
doubleword,
quadword, and
halfword, also vary with the CPU and OS.
Standard integer The standard integer size is platform-dependent. In
C, it is denoted by and required to be at least 16 bits. Windows and Unix systems have 32-bit s on both 32-bit and 64-bit architectures.
Short integer A
short integer can represent a whole number that may take less storage, while having a smaller range, compared with a standard integer on the same machine. In
C, it is denoted by . It is required to be at least 16 bits, and is often smaller than a standard integer, but this is not required. and , but it may not assume that the range is not larger. In
Java, a is a 16-bit integer. In the
Windows API, the datatype is defined as a 16-bit signed integer on all machines. This can be an issue when exchanging code and data between platforms, or doing direct hardware access. Thus, there are several sets of headers providing platform independent exact width types. The C
standard library provides stdint.h|; this was introduced in C99 and C++11. == Syntax ==