In computer science, an integer is a datum of integral data type , a data type that represents some range of mathematical integers . Integral data types may be of different sizes and may or may not be allowed to contain negative values. Integers are commonly represented in a computer as a group of binary digits (bits). The size of the grouping varies so the set of integer sizes available varies between different types of computers. Computer hardware nearly always provides a way to represent a processor register or memory address as an integer.
31-1092: [REDACTED] Look up long , Long , or Appendix:Variations of "long" in Wiktionary, the free dictionary. Long may refer to: Measurement [ edit ] Long, characteristic of something of great duration Long, characteristic of something of great length Longitude (abbreviation: long.), a geographic coordinate Longa (music) , note value in early music mensural notation Places [ edit ] Asia [ edit ] Long District, Laos Long District, Phrae , Thailand Longjiang (disambiguation) or River Long (lit. "dragon river"), one of several rivers in China Yangtze River or Changjiang (lit. "Long River"), China Elsewhere [ edit ] Long, Somme , France People [ edit ] Long (Chinese surname) Long (Western surname) Fictional characters [ edit ] Long ( Bloody Roar ) , in
62-615: A nibble ), usually with additional bits for a sign. Many modern CPUs provide limited support for decimal integers as an extended datatype, providing instructions for converting such values to and from binary values. Depending on the architecture, decimal integers may have fixed sizes (e.g., 7 decimal digits plus a sign fit into a 32-bit word), or may be variable-length (up to some maximum digit size), typically occupying two digits per byte (octet). IPv6 addresses, GUIDs Different CPUs support different integral data types. Typically, hardware will support both signed and unsigned types, but only
93-656: A 1968 song by The Beatles Long long , a type of integer data type in computing Longleng a district of Phom people in Nagaland, India Short (disambiguation) Topics referred to by the same term [REDACTED] This disambiguation page lists articles associated with the title Long . If an internal link led you here, you may wish to change the link to point directly to the intended article. Retrieved from " https://en.wikipedia.org/w/index.php?title=Long&oldid=1259321335 " Category : Disambiguation pages Hidden categories: Short description
124-600: A 1968 song by The Beatles Long long , a type of integer data type in computing Longleng a district of Phom people in Nagaland, India Short (disambiguation) Topics referred to by the same term [REDACTED] This disambiguation page lists articles associated with the title Long . If an internal link led you here, you may wish to change the link to point directly to the intended article. Retrieved from " https://en.wikipedia.org/w/index.php?title=Long&oldid=1259321335 " Category : Disambiguation pages Hidden categories: Short description
155-452: A computer has some minimal and maximum possible value. The most common representation of a positive integer is a string of bits , using the binary numeral system . The order of the memory bytes storing the bits varies; see endianness . The width , precision , or bitness of an integral type is the number of bits in its representation. An integral type with n bits can encode 2 numbers; for example an unsigned type typically represents
186-586: A geographic coordinate Longa (music) , note value in early music mensural notation Places [ edit ] Asia [ edit ] Long District, Laos Long District, Phrae , Thailand Longjiang (disambiguation) or River Long (lit. "dragon river"), one of several rivers in China Yangtze River or Changjiang (lit. "Long River"), China Elsewhere [ edit ] Long, Somme , France People [ edit ] Long (Chinese surname) Long (Western surname) Fictional characters [ edit ] Long ( Bloody Roar ) , in
217-782: A laneway in Shanghai Long integer , a computer data type denoted by long in many programming languages Lóng, pinyin transliteration of 龍 or 龙, the Chinese characters for " Chinese dragon " See also [ edit ] [REDACTED] Search for "Long" on Misplaced Pages. All pages with titles beginning with Long All pages with titles containing longs All pages with titles containing long Length (disambiguation) Long County (disambiguation) Long Island (disambiguation) Long Lake (disambiguation) Long Mountain (disambiguation) Justice Long (disambiguation) " Long, Long, Long ",
248-664: A laneway in Shanghai Long integer , a computer data type denoted by long in many programming languages Lóng, pinyin transliteration of 龍 or 龙, the Chinese characters for " Chinese dragon " See also [ edit ] [REDACTED] Search for "Long" on Misplaced Pages. All pages with titles beginning with Long All pages with titles containing longs All pages with titles containing long Length (disambiguation) Long County (disambiguation) Long Island (disambiguation) Long Lake (disambiguation) Long Mountain (disambiguation) Justice Long (disambiguation) " Long, Long, Long ",
279-663: A machine-independent way; others have varying definitions depending on the underlying processor word size. Not all language implementations define variables of all integer sizes, and defined sizes may not even be distinct in a particular implementation. An integer in one programming language may be a different size in a different language, on a different processor, or in an execution context of different bitness; see § Words . Some older computer architectures used decimal representations of integers, stored in binary-coded decimal (BCD) or other format. These values generally require data sizes of 4 bits per decimal digit (sometimes called
310-523: A programmer using the C language incorrectly declares as int a variable that will be used to store values greater than 2 −1, the program will fail on computers with 16-bit integers. That variable should have been declared as long , which has at least 32 bits on any computer. Programmers may also incorrectly assume that a pointer can be converted to an integer without loss of information, which may work on (some) 32-bit computers, but fail on 64-bit computers with 64-bit pointers and 32-bit integers. This issue
341-436: 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. The term byte initially meant 'the smallest addressable unit of memory'. In
SECTION 10
#1732765871722372-416: 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
403-455: A whole integer whose range is greater than or equal to that of a standard integer on the same machine. In C , it is denoted by long . It is required to be at least 32 bits, and may or may not be larger than a standard integer. A conforming program can assume that it can safely store values between −(2 −1) and 2 −1, but it may not assume that the range is not larger. In the C99 version of
434-422: 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-bit. 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
465-403: Is convenient because there is a perfect one-to-one correspondence between representations and values (in particular, no separate +0 and −0 ), and because addition , subtraction and multiplication do not need to distinguish between signed and unsigned types. Other possibilities include offset binary , sign-magnitude , and ones' complement . Some computer languages define integer sizes in
496-490: Is different from Wikidata All article disambiguation pages All disambiguation pages long [REDACTED] Look up long , Long , or Appendix:Variations of "long" in Wiktionary, the free dictionary. Long may refer to: Measurement [ edit ] Long, characteristic of something of great duration Long, characteristic of something of great length Longitude (abbreviation: long.),
527-412: Is different from Wikidata All article disambiguation pages All disambiguation pages Long long The value of an item with an integral type is the mathematical integer that it corresponds to. Integral types may be unsigned (capable of representing only non-negative integers) or signed (capable of representing negative integers as well). An integer value is typically specified in
558-459: Is often smaller than a standard integer, but this is not required. A conforming program can assume that it can safely store values between −(2 −1) and 2 −1, but it may not assume that the range is not larger. In Java , a short is always a 16-bit integer. In the Windows API , the datatype SHORT is defined as a 16-bit signed integer on all machines. A long integer can represent
589-475: Is permitted. 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. Integer literals can be written as regular Arabic numerals , consisting of a sequence of digits and with negation indicated by
620-423: Is platform-dependent. In C , it is denoted by int and required to be at least 16 bits. Windows and Unix systems have 32-bit int s on both 32-bit and 64-bit architectures. 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 short . It is required to be at least 16 bits, and
651-491: Is resolved by C99 in stdint.h in the form of intptr_t . The bitness of a program may refer to the word size (or bitness) of the processor on which it runs, or it may refer to the width of a memory address or pointer, which can differ between execution modes or contexts. For example, 64-bit versions of Microsoft Windows support existing 32-bit binaries, and programs compiled for Linux's x32 ABI run in 64-bit mode yet use 32-bit memory addresses. The standard integer size
SECTION 20
#1732765871722682-640: The C programming language and the C++11 version of C++ , a long long type is supported that has double the minimum capacity of the standard long . This type is not supported by compilers that require C code to be compliant with the previous C++ standard, C++03, because the long long type did not exist in C++03. For an ANSI/ISO compliant compiler, the minimum requirements for the specified ranges, that is, −(2 −1) to 2 −1 for signed and 0 to 2 −1 for unsigned, must be fulfilled; however, extending this range
713-404: The source code of a program as a sequence of digits optionally prefixed with + or −. Some programming languages allow other notations, such as hexadecimal (base 16) or octal (base 8). Some programming languages also permit digit group separators . The internal representation of this datum is the way the value is stored in the computer's memory. Unlike mathematical integers, a typical datum in
744-465: The CPU and OS. Practically all new desktop processors are capable of using 64-bit words, though embedded processors with 8- and 16-bit word size are still common. The 36-bit word length was common in the early days of computers. One important cause of non-portability of software is the incorrect assumption that all computers have the same word size as the computer used by the programmer. For example, if
775-517: 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 or Flag 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
806-407: 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 . The term 'word' is used for a small group of bits that are handled simultaneously by processors of a particular architecture . The size of
837-567: 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 BigInteger class or Perl 's " bigint " package. These use as much of
868-471: The non-negative values 0 through 2 − 1 . Other encodings of integer values to bit patterns are sometimes used, for example binary-coded decimal or Gray code , or as printed character codes such as ASCII . There are four well-known ways to represent signed numbers in a binary computing system. The most common is two's complement , which allows a signed integral type with n bits to represent numbers from −2 through 2 − 1 . Two's complement arithmetic
899-407: 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
930-500: The video game series Long, Aeon of Permanence in Honkai: Star Rail Sports [ edit ] Long, a fielding term in cricket Long, in tennis and similar games, beyond the service line during a serve and beyond the baseline during play Other uses [ edit ] USS Long , a U.S. Navy ship name Long (finance) , a position in finance, especially stock markets Lòng , name for
961-424: The video game series Long, Aeon of Permanence in Honkai: Star Rail Sports [ edit ] Long, a fielding term in cricket Long, in tennis and similar games, beyond the service line during a serve and beyond the baseline during play Other uses [ edit ] USS Long , a U.S. Navy ship name Long (finance) , a position in finance, especially stock markets Lòng , name for