|
In programming languages a data type defines a set of values and the allowable operations on those values[1]. For example, in the Java programming language, the "int" type represents the set of 32-bit integers ranging in value from -2,147,483,648 to 2,147,483,647, and the operations such as addition, subtraction, and multiplication that can be performed on integers. Almost all programming languages explicitly include the notion of data type, though different languages may use different terminology. Common data types in programming languages include those that represent integers, floating point numbers, and characters, and a language may support many more. Most programming languages also allow the programmer to define additional data types, usually by combining multiple elements of other types and defining the valid operations of the new data type. For example, a programmer might create a new data type named "Person" that specifies that data interpreted as Person would include a name and a date of birth. Image File history File links Broom_icon. ...
Other listings of programming languages are: Categorical list of programming languages Generational list of programming languages Chronological list of programming languages Note: Esoteric programming languages have been moved to the separate List of esoteric programming languages. ...
âJava languageâ redirects here. ...
A data type can also be thought of as a constraint placed upon the interpretation of data in a type system, describing representation, interpretation and structure of values or objects stored in computer memory. The type system uses data type information to check correctness of computer programs that access or manipulate the data. In computer science, a type system defines how a programming language classifies values and expressions into types, how it can manipulate those types and how they interact. ...
In computer science, a value is a sequence of bits that is interpreted according to some data type. ...
In strictly mathematical branches of computer science the term object is used in a purely mathematical sense to refer to any thing. While this interpretation is useful in the discussion of abstract theory, it is not concrete enough to serve as a primitive datatype in the discussion of more concrete...
In theoretical computer science, correctness of an algorithm is asserted when it is said that the algorithm is correct with respect to a specification. ...
Machine data types All data in computers based on digital electronics is represented as bits (alternatives 0 and 1) on the lowest level. The smallest addressable unit of data is a group of bits called a byte (usually an octet, which is 8 bits). The unit processed by machine code instructions is called a word (as of 2006, typically 32 or 64 bits). Most instructions interpret the word as a binary number, such that a 32-bit word can represent unsigned integer values from 0 to 232 − 1 or signed integer values from − 231 to 231 − 1. Because of two's complement, the machine language and machine don't need to distinguish between these unsigned and signed data types for the most part. This article is about the unit of information. ...
In computer science a byte (pronounced bite) is a unit of measurement of information storage, most often consisting of eight bits. ...
In computer technology and networking, an octet is a group of 8 bits. ...
Machine code or machine language is a system of instructions and data directly understandable by a computers central processing unit. ...
In computing, word is a term for the natural unit of data used by a particular computer design. ...
The binary or base-two numeral system is a system for representing numbers in which a radix of two is used; that is, each digit in a binary numeral may have either of two different values. ...
The twos complement of a binary number is the value obtained by subtracting the number from a large power of two (specifically, from 2N for an N-bit twos complement). ...
There is a specific set of arithmetic instructions that use a different interpretation of the bits in word as a floating-point number. This article or section is in need of attention from an expert on the subject. ...
Primitive types Integer numbers An integer number can hold a whole number, but no fraction. Integers may be either signed (allowing negative values) or unsigned (nonnegative values only). Typical sizes of integers are: | Size | Names | Signed Range | Unsigned Range | | 8 bits | Byte | -128 to +127 | 0 to 255 | | 16 bits | Word, short int | -32,768 to +32,767 | 0 to 65 535 | | 32 bits | Double Word, long int | -2,147,483,648 to +2,147,483,647 | 0 to 4,294,967,295 | | 64 bits | long long (C), long (Java) | –9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 | 0 to 18,446,744,073,709,551,615 | | unlimited | Bignum | Literals for integers consist of a sequence of digits. Most programming languages disallow the use of commas for digit grouping, although FORTRAN (77 and Fortran 90 and above fixed form source but not free form source) allows embedded spaces, and Perl and D allow embedded underscores. Negation is indicated by a minus sign (-) before the value. Examples of integer literals are: In computer science a byte (pronounced bite) is a unit of measurement of information storage, most often consisting of eight bits. ...
In computing, word is a term for the natural unit of data used by a particular computer design. ...
For other uses, see Word (disambiguation). ...
C is a general-purpose, block structured, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. ...
âJava languageâ redirects here. ...
A bignum package in a computer or program allows internal representation of very large integers, rational numbers, decimal numbers, or floating-point numbers (limitted only by available memory), and provides a set of arithmetic operations on such numbers. ...
Fortran (previously FORTRAN[1]) is a general-purpose[2], procedural,[3] imperative programming language that is especially suited to numeric computation and scientific computing. ...
Wikibooks has a book on the topic of Perl Programming Perl is a dynamic programming language created by Larry Wall and first released in 1987. ...
For other programming languages named D, see D (disambiguation)#Computing. ...
The underscore _ is the character with ASCII value 95. ...
Wiki Wiki Wik Wik!!
Booleans A boolean type, typically denoted "bool" or "boolean", is a single-bit type that can be either "true" (1) or "false" (0). In some languages (e.g., C++), bools may be implicitly converted to integers (for example, "true + true" is a valid expression equal to 2), but other languages (e.g., Java and Pascal) disallow this. In computer science, the Boolean datatype, sometimes called the logical datatype, is a primitive datatype having two values: one and zero (which are equivalent to true and false). ...
C++ (pronounced see plus plus, IPA: ) is a general-purpose programming language with high-level and low-level capabilities. ...
âJava languageâ redirects here. ...
Pascal is a structured imperative computer programming language, developed in 1970 by Niklaus Wirth as a language particularly suitable for structured programming. ...
Floating-point numbers A floating-point number represents a real number that may have a fractional part. These numbers are stored internally in scientific notation, typically in binary but sometimes in decimal. Because floating-point number have only a limited number of digits, most values can be represented only approximately. This article or section is in need of attention from an expert on the subject. ...
In mathematics, the real numbers may be described informally as numbers that can be given by an infinite decimal representation, such as 2. ...
Scientific notation, also known as standard form, is a notation for writing numbers that is often used by scientists and mathematicians to make it easier to write large and small numbers. ...
The binary numeral system, or base-2 number system, is a numeral system that represents numeric values using two symbols, usually 0 and 1. ...
For other uses, see Decimal (disambiguation). ...
Many languages have both a single precision (often called "float") and a double precision type. In computing, single precision is a computer numbering format that occupies one storage locations in computer memory at address. ...
In computing, double precision is a computer numbering format that occupies two storage locations in computer memory at address and address+1. ...
Literals for floating point numbers include a decimal point, and typically use "e" to denote scientific notation. Examples of floating-point literals are: - 20.0005
- 99.9
- -5000.12
- 6.02e23
Some languages (e.g., FORTRAN) also have a complex number type comprising two floating-point numbers: a real part and an imaginary part. Fortran (previously FORTRAN[1]) is a general-purpose[2], procedural,[3] imperative programming language that is especially suited to numeric computation and scientific computing. ...
In mathematics, a complex number is a number of the form where a and b are real numbers, and i is the imaginary unit, with the property i 2 = â1. ...
Characters and strings A character type (typically called "char") may contain a single letter, digit, punctuation mark, or control character. Some languages have two character types, a single-byte type for ASCII characters and a multi-byte type for Unicode characters. A Specimen of typeset fonts and languages, by William Caslon, letter founder; from the 1728 Cyclopaedia. ...
In mathematics and computer science, a numerical digit is a symbol, e. ...
Punctuation marks are written symbols that do not correspond to either phonemes (sounds) of a spoken language nor to lexemes (words and phrases) of a written language, but which serve to organize or clarify written language. ...
In computing, a control character or non-printing character, is a code point (a number) in a character set that does not in itself represent a written symbol. ...
Image:ASCII fullsvg There are 95 printable ASCII characters, numbered 32 to 126. ...
The Unicode Standard, Version 5. ...
Characters may be combined into strings. The string data can include numbers and other numerical symbols but will be treated as text. In computer programming and formal language theory, (and other branches of mathematics), a string is an ordered sequence of symbols. ...
In most languages, a string is equivalent to an array of characters, but Java treats them as distinct types. Other languages (such as Python, and many dialects of BASIC) have no separate character type, but only strings with a length of one. âJava languageâ redirects here. ...
Python is a high-level programming language first released by Guido van Rossum in 1991. ...
BASIC is a family of high-level programming languages. ...
Literals for characters and strings are usually surrounded by quotation marks: often, single quotes (') are used for characters and double quotes (") are used for strings. The symbol ″, while technically the double-prime, is also used to mean inch. ...
Examples of character literals in C syntax are: Examples of string literals in C syntax are: This article is about the use of the term Tab in computing. ...
- "A"
- "Hello World"
- "I am 6000 years old"
Numeric data type ranges Each numeric data type has a maximum and minimum value known as the range. Attempting to store a number outside the range may lead to compiler/runtime errors, or to incorrect calculations (due to truncation) depending on the language being used. In computer science, the term range may refer to one of two things: The maximum and minimum values that may be stored in a variable. ...
In mathematics, truncation is the term used for reducing the number of digits right of the decimal point, by discarding the least significant ones. ...
The range of a variable is based on the number of bytes used to save the value, and an integer data type is usually[2] able to store 2n values (where n is the number of bits). For other data types (e.g. floating point values) the range is more complicated and will vary depending on the method used to store it. There are also some types that do not use entire bytes, e.g. a boolean that requires a single bit, and represents a binary value (although in practice a byte is often used, with the remaining 7 bits being redundant). Some programming languages (such as Ada and Pascal) also allow the opposite direction, that is, the programmer defines the range and precision needed to solve a given problem and the compiler chooses the most appropriate integer or floating point type automatically. This article is about the unit of information. ...
A floating-point number is a digital representation for a number in a certain subset of the rational numbers, and is often used to approximate an arbitrary real number on a computer. ...
This article is about the unit of information. ...
The binary numeral system, or base-2 number system, is a numeral system that represents numeric values using two symbols, usually 0 and 1. ...
Ada is a structured, statically typed, imperative, and object-oriented high-level computer programming language. ...
Pascal is a structured imperative computer programming language, developed in 1970 by Niklaus Wirth as a language particularly suitable for structured programming. ...
Composite types -
- Further information: Tuple
- Further information: Array
- Further information: Storage record
- Further information: Object composition
In computer science, composite types are datatypes which can be constructed in a programming language out of that languages primitive types and other composite types. ...
In mathematics, a tuple is a finite sequence (also known as an ordered list) of objects, each of a specified type. ...
This article does not cite any references or sources. ...
In computer science, a storage record is: a group of related data, words, or fields treated as a meaningful unit; for instance, a Name, Address, and Telephone Number can be a Personal Record; a self-contained collection of information about a single object; a record is made up of a...
This article does not cite any references or sources. ...
Abstract data types -
In computing, an abstract data type (ADT) is a specification of a set of data and the set of operations that can be performed on the data. ...
Pointer and reference types -
- Further information: Pointer
This article is about a general notion of reference in computing. ...
It has been suggested that Software pointer be merged into this article or section. ...
Algebraic types -
An algebraic data type is a datatype whose each value is data from other datatypes wrapped in one of the constructors of the datatype. ...
Object types -
- Further information: Class (computer science)
In strictly mathematical branches of computer science the term object is used in a purely mathematical sense to refer to any thing. While this interpretation is useful in the discussion of abstract theory, it is not concrete enough to serve as a primitive datatype in the discussion of more concrete...
In object-oriented programming, a class is a programming language construct that is used to group related instance variables and methods. ...
Function types -
A function object, often called a functor, is a computer programming construct allowing an object to be invoked or called as if it were an ordinary function, usually with the same syntax. ...
See also - Type theory for the mathematical models of types
- Type system for different choices in programming language typing
At the broadest level, type theory is the branch of mathematics and logic that first creates a hierarchy of types, then assigns each mathematical (and possibly other) entity to a type. ...
In computer science, a type system defines how a programming language classifies values and expressions into types, how it can manipulate those types and how they interact. ...
Notes - ^ http://www.sigcse.org/cc2001/PL.html
- ^ There are situations where one or more bits are reserved for other functions, e.g. parity checking.
References - Luca Cardelli, Peter Wegner. On Understanding Types, Data Abstraction, and Polymorphism, [1] from Computing Surveys, (December, 1985)
|