In computer science, primitive data types are a set of basic data types from which all other data types are constructed.Specifically it often refers to the limited set of data representations in use by a particular processor, which all compiled programs must use. Most processors support a similar set of primitive data types, although the specific representations vary. More generally, "primitive data types" may refer to the standard data types built into a programming language. Data types which are not primitive are referred to as derived or composite.
Primitive types are almost always value types, but composite types may also be value types.
The Java virtual machine's set of primitive data types is:
returnAddress) This is not accessible from the Java programming language and is usually left out.
These primitive types are in general precisely those supported by computer hardware, except possibly for varying integer sizes or hardware that is missing floating point. Operations on such primitives are usually quite efficient. Primitive data types which are native to the processor have a one-to-one correspondence with objects in the computer's memory, and operations on these types are often the fastest possible in most cases. : 113Integer addition, for example, can be performed as a single machine instruction, and some offer specific instructions to process sequences of characters with a single instruction. But the choice of primitive data type may affect performance, for example it is faster using SIMD operations and data types to operate on an array of floats.
The set of basic C data types is similar to Java's. Minimally, there are four types,
double, but the qualifiers
unsigned mean that C contains numerous target-dependent integer and floating-point primitive types.
An integer data type represents some range of mathematical integers. Integers may be either signed (allowing negative values) or unsigned (non-negative integers only). Common ranges are:
|Size (bytes)||Size (bits)||Names||Signed range (two's complement representation)||Unsigned range|
|1 byte||8 bits|| Byte, octet, minimum size of ||−128 to +127||0 to 255|
|2 bytes||16 bits|| x86 word, minimum size of ||−32,768 to +32,767||0 to 65,535|
|4 bytes||32 bits||x86 double word, minimum size of ||−2,147,483,648 to +2,147,483,647||0 to 4,294,967,295|
|8 bytes||64 bits||x86 quadruple word, minimum size of ||−9,223,372,036,854,775,808 to +9,223,372,036,854,775,807||0 to 18,446,744,073,709,551,615|
A floating-point number represents a limited-precision rational number that may have a fractional part. These numbers are stored internally in a format equivalent to scientific notation, typically in binary but sometimes in decimal. Because floating-point numbers have limited precision, only a subset of real or rational numbers are exactly representable; other numbers can be represented only approximately. Many languages have both a single precision (often called "float") and a double precision type (often called "double").
A boolean type, typically denoted "bool" or "boolean", is typically a logical type that can have either the value "true" or the value "false". Although only one bit is necessary to accommodate the value set "true" and "false", programming languages typically implement boolean types as one or more bytes.
Many languages (e.g. Java, Pascal and Ada) implement booleans adhering to the concept of boolean as a distinct logical type. Some languages, though, may implicitly convert booleans to numeric types at times to give extended semantics to booleans and boolean expressions or to achieve backwards compatibility with earlier versions of the language. For example, early versions of the C programming language that followed ANSI C and its former standards did not have a dedicated boolean type. Instead, numeric values of zero are interpreted as "false", and any other value is interpreted as "true".
bool as a built-in type and "true" and "false" as reserved words.
The XML Schema Definition language provides a set of 19 primitive data types:
string: a string, a sequence of Unicode code points
boolean: a boolean
decimal: a number represented with decimal notation
double: floating-point numbers
gMonth: Calendar dates and times
base64Binary: binary data encoded as hexadecimal or Base64
anyURI: a URI
QName: a qualified name
NOTATION: a QName declared as a notation in the schema. Notations are used to embed non-XML data types. This type cannot be used directly - only derived types that enumerate a limited set of QNames may be used.
In Visual Basic .NET, the primitive data types consist of 4 integral types, 2 floating-point types, a 16-byte decimal type, a boolean type, a date/time type, a Unicode character type, and a Unicode string type.
In general, data types that can be built into sophisticated programming languages include:
Integertype in Common Lisp, Erlang, Haskell
Some languages have "character" or "string" types that are too small to represent all Unicode characters or strings. These are more properly categorized as integer types. For example C includes a
char type, but it is defined to be the smallest addressable unit of memory, which several standards, such as POSIX require to be 8 bits. The recent version of these standards refer to
char as a numeric type.
char is also used for a 16-bit integer type in Java, but again this is not a Unicode character type. Some computer hardware has a few instructions which deal with "strings", referring to a sequence of bytes. For example, x86-64 can move, set, search, or compare a sequence of items, where an item could be 1, 2, 4, or 8 bytes long.
A range numeric data type has its maximum and minimum value embedded in the type. It is included in some languages such as Ada and Pascal. 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 practice the compiler chooses the most appropriate primitive integer or floating-point type automatically.
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.
Double-precision floating-point format is a computer number format, usually occupying 64 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point.
In computer programming, an S-expression is an expression in a like-named notation for nested list (tree-structured) data. S-expressions were invented for and popularized by the programming language Lisp, which uses them for source code as well as data.
In computer science and computer programming, a data type or simply type is an attribute of data which tells the compiler or interpreter how the programmer intends to use the data. Most programming languages support basic data types of integer numbers, floating-point numbers, characters and Booleans. A data type constrains the values that an expression, such as a variable or a function, might take. This data type defines the operations that can be done on the data, the meaning of the data, and the way values of that type can be stored. A data type provides a set of values from which an expression may take its values.
In computer science, type conversion, type casting, type coercion, and type juggling are different ways of changing an expression from one data type to another. An example would be the conversion of an integer value into a floating point value or its textual representation as a string, and vice versa. Type conversions can take advantage of certain features of type hierarchies or data representations. Two important aspects of a type conversion are whether it happens implicitly (automatically) or explicitly, and whether the underlying data representation is converted from one representation into another, or a given representation is merely reinterpreted as the representation of another data type. In general, both primitive and compound data types can be converted.
In computer science, the Boolean is a data type that has one of two possible values which is intended to represent the two truth values of logic and Boolean algebra. It is named after George Boole, who first defined an algebraic system of logic in the mid 19th century. The Boolean data type is primarily associated with conditional statements, which allow different actions by changing control flow depending on whether a programmer-specified Boolean condition evaluates to true or false. It is a special case of a more general logical data type —logic doesn't always need to be Boolean.
In computer science, string interning is a method of storing only one copy of each distinct string value, which must be immutable. Interning strings makes some string processing tasks more time- or space-efficient at the cost of requiring more time when the string is created or interned. The distinct values are stored in a string intern pool.
JSON is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays. It is a common data format with diverse uses in electronic data interchange, including that of web applications with servers.
In the C programming language, data types constitute the semantics and characteristics of storage of data elements. They are expressed in the language syntax in form of declarations for memory locations or variables. Data types also determine the types of operations or methods of processing of data elements.
Action Message Format (AMF) is a binary format used to serialize object graphs such as ActionScript objects and XML, or send messages between an Adobe Flash client and a remote service, usually a Flash Media Server or third party alternatives. The Actionscript 3 language provides classes for encoding and decoding from the AMF format.
This article compares a large number of programming languages by tabulating their data types, their expression, statement, and declaration syntax, and some common operating-system interfaces.
Some programming languages provide a complex data type for complex number storage and arithmetic as a built-in (primitive) data type.
This is a comparison of data-serialization formats, various ways to convert complex objects to sequences of bits. It does not include markup languages used exclusively as document file formats.
Some programming languages provide a built-in (primitive) or library decimal data type to represent non-repeating decimal fractions like 0.3 and -1.17 without rounding, and to do arithmetic on them. Examples are the
decimal.Decimal type of Python, and analogous types provided by other languages.
Universal Binary JSON (UBJSON) is a computer data interchange format. It is a binary form directly imitating JSON, but requiring fewer bytes of data. It aims to achieve the generality of JSON, combined with being much easier to process than JSON.
A character literal is a type of literal in programming for the representation of a single character's value within the source code of a computer program.
JSON→URL is a language-independent data interchange format for the JSON data model suitable for use within a URL/URI query string. It is defined by an open specification, though not through a standards body.
Integer operations are fast in most cases, [...]