Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Data type
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Concept == A data type may be specified for many reasons: similarity, convenience, or to focus the attention. It is frequently a matter of good organization that aids the understanding of complex definitions. Almost all programming languages explicitly include the notion of data type, though the possible data types are often restricted by considerations of simplicity, computability, or regularity. An explicit data type declaration typically allows the compiler to choose an efficient machine representation, but the conceptual organization offered by data types should not be discounted.<ref>{{cite journal |last1=Scott |first1=Dana |title=Data Types as Lattices |journal=SIAM Journal on Computing |date=September 1976 |volume=5 |issue=3 |pages=540β541 |doi=10.1137/0205037}}</ref> Different languages may use different data types or similar types with different semantics. For example, in the [[Python (programming language)|Python programming language]], <code>int</code> represents an [[Arbitrary-precision arithmetic|arbitrary-precision integer]] which has the traditional numeric operations such as addition, subtraction, and multiplication. However, in the [[Java (programming language)|Java programming language]], the type <code>int</code> represents the set of [[32-bit]] [[Integer (computer science)|integers]] ranging in value from β2,147,483,648 to 2,147,483,647, with arithmetic operations that wrap on [[Integer overflow|overflow]]. In [[Rust (programming language)|Rust]] this 32-bit integer type is denoted <code>i32</code> and panics on overflow in debug mode.<ref>{{cite web |title=Rust RFCs - Integer Overflow |url=https://github.com/rust-lang/rfcs/blob/master/text/0560-integer-overflow.md |publisher=The Rust Programming Language |date=12 August 2022}}</ref> 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 "[[complex number]]" that would include real and imaginary parts, or a color data type represented by three [[byte]]s denoting the amounts each of red, green, and blue, and a string representing the color's name. Data types are used within [[type system]]s, which offer various ways of defining, implementing, and using them. In a type system, a data type represents a constraint placed upon the interpretation of data, describing representation, interpretation and structure of [[Value (computer science)|value]]s or [[object (computer science)|object]]s stored in computer memory. The type system uses data type information to check [[correctness of computer programs]] that access or manipulate the data. A [[compiler]] may use the static type of a value to optimize the storage it needs and the choice of algorithms for operations on the value. In many [[C (programming language)|C]] compilers the {{C-lang|float}} data type, for example, is represented in 32 [[bit]]s, in accord with the [[IEEE 754-2008|IEEE specification for single-precision floating point numbers]]. They will thus use floating-point-specific [[instruction set|microprocessor operations]] on those values (floating-point addition, multiplication, etc.).
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Data type
(section)
Add topic