Datatype

format_list_bulleted Contenido keyboard_arrow_down
ImprimirCitar

In computer science, a computer data type or simply type is a data attribute that indicates to the computer (and/or programmer) about the kind of data to be handled. This includes placing constraints on the data, such as what values it can take and what operations it can perform.

The most common data types are: integers, signed (negative) numbers, floating point (decimal) numbers, alphanumeric (and unicode) strings, states, etc.

Information

Diagram showing some types of data.

A data type is a space in memory with restrictions. For example, the type "int" generally represents a set of 32-bit integers whose range goes from -2,147,483,648 to 2,147,483,647, as well as the operations that can be performed with integers, such as addition, subtraction, and multiplication. The colors, for their part, are represented as three bytes denoting the amount of red, green and blue, and a string of characters representing the name of the color (in this case, the allowed operations include addition and subtraction, but not the multiplication).

This is a concept of computer science, and more specifically of programming languages, although it is also related to similar notions of mathematics and logic.

In a broad sense, a data type defines a set of values and the operations on those values. Almost all programming languages explicitly include data type notation, although different languages may use different terminology. Most programming languages allow the programmer to define additional data types, usually by combining multiple elements of other types and defining the operations of the new data type. For example, a programmer might create a new data type called "Person", contemplating that the data interpreted as "Person" include a name and date of birth.

A data type can also be seen as a constraint imposed on the interpretation of data in a typing system, describing the representation, interpretation, and structure of values or objects stored in computer memory. The typing system uses information from data types to check the verification of programs that access or manipulate the data.

Data type classes

Python 3. The standard type hierarchy.png

Primitive (or elementary) data types

The types of data refer to the type of information that is processed, where the minimum storage unit is the data, it can also be considered as the range of values that a variable can take during the execution of the program.

Characters

The character data type is a single digit which can be represented as numerics (0 through 9), letters (a-z), and symbols (!"$&/).

Type of data Range Memory size
Char 10 21 bits by character

Unicode characters

The unicode character data type is an "extension" of the character data type, allows to extend the writing symbols, provides exactly up to 65535 different characters.

Note: In the Java language, the Unicode encoding allows working with all the characters of different languages.

Type of data Range Memory size
short 0 to 65535 16 bits by character

Numeric

This data type can be real or integer, depending on the data type to be used.

Integers: are the values that do not have a decimal point, can be positive or negative and zero.

Type of data Memory size
byte 8 bits
short 16 bits
int 32 bits
long 64 bits

Reals: These characters store very large numbers that have an integer part and a decimal part.

Type of data Memory size
float 32 bits
double 64 bits

these would be their ordered ranges and sizes

Booleans

This type of data is used for logical values, we can define them as comparative data, said comparison returns logical results (True or False).

Type of data Memory size
Boolean 8 bits

Composite types

Compound types are derived from one or more data primitives. The different ways of forming or combining this data are known as “Data Structure”. By combining it we can create a new type, for example:

"array-of-integers" is different from the type "integer".

  • A Vector (or arrangement of the original in English array) stores a number of items of the same type in a specific order. The arrays can be static (with a fixed measure) or dynamic (grow during your life cycle).
  • A Registry or Tupla.
  • A set.

Data types in different languages

Pascal

The Pascal programming language allows you to declare character (String) and numeric variables. As can be seen, all variables except the String type are of numeric type (including Boolean).

NameRequired memoryRankDescription
Booleano1bit1 ~ 0True - False
Byte1 byte (8 Bits)0 ~ 255Byte without a sign.
ByteSig1 byte (8 Bits)(-128) ~ 127Byte with a sign.
Word2 byte (16 Bits)0 ~ 65.535Word without a sign.
WordSig2 byte (16 Bits)(-32768) ~ 32767Word with sign.
Entero4 byte (32 Bits)0 ~ 4.294.967.295Entero without a sign.
EnteroSig4 byte (32 Bits)(-2.147.483.648) ~ 2.147.483.647Entero with sign.
Real8 byte (64 Bits)(-1,79769313486232^308) ~ (-4,94065645841247^-324)Number with double-precision floating comma
Decimal8 byte (64 Bits)(-922.337.203.685.477.5800) ~ 922.337.203.685.477.5800Number with fixed comma of 4 decimals.
Chain1 byte by character0 ~ 2000 million charactersChain of alphanumeric characters.

Java

The Java programming language allows you to declare variables of primitive type, but since the wrappers of such functions have many useful operations, it is more common to make use of classes that handle them.

NameDeclarationRequired memoryIntervaloDescription
BooleanoBoolean-true - falseDefine a flag that can take two possible values: true or false.
Bytebyte1 byte (8 bits)[-128.. 127]Representation of the lower number with sign.
Small janitorshort2 byte (16 bits)[-32,768.. 32,767]Representation of an integer whose rank is small.
Enteroint4 byte (32 bits)[-2]31.. 231-1]Representation of a standard integer. This guy can be represented without a sign using his class. Integer from Java SE 8.
Longintlong8 byte (64 bits)[-2]63.. 263-1]Representation of an enlarged integer. This guy can be represented without a sign using his class. Long from Java SE 8.
Realfloat4 byte (32 bits)[±3.4·10-38.. ±3,4·1038]Representation of a real standard. Remember that when it is real, the accuracy of the data varies depending on the size of the number: the accuracy is widened with numbers closer to 0 and decreases the more it moves away from it.
Real longdouble8 byte (64 bits)[±1.7·10-308.. ±1,7·10308]Representation of a more accurate real. Double has the same effect with the precision that floats.
CharacterChar2 byte (16 bits)['u0000'.. 'uffff'] or [0.. 65.535]Character or symbol. To compose a chain you need to use the class StringIt can't be done as a primitive type.

Abstract Types

Don't confuse these data types with abstract data types.

ADTs follow an interface that specifies what that data type does (the data structure would be the concrete implementation). Formally it is a mathematical model for data types that are defined by their behavior or semantics. At the user level, it can be seen as the data schema and operations to manipulate the elements that make up that type of data. The data structure would be the concrete representation of the data.

Contenido relacionado

Internet explorer

Internet Explorer was a web browser developed by Microsoft for the Microsoft Windows operating system since 1995. It was first released as part of the Plus!...

Computer scanner

When obtaining a digital image, defects can be corrected, a specific area of the image can be cropped or text can also be digitized using OCR techniques....

GIMP

GIMP >rogram) is a program for editing digital images in the form of bitmaps, both drawings and photographs. It is a free and open program. It is part of the...
Más resultados...
Tamaño del texto:
undoredo
format_boldformat_italicformat_underlinedstrikethrough_ssuperscriptsubscriptlink
save