Parameter name Meaning
Article topic: Standard types data
Rubric (thematic category) Programming

Standard types include integer, real, logical and other types.

Integers types define constants, variables and functions, the values ​​of which are realized by the set of integers allowed in a given computer.

Type Range of values Memory Required
Shortint -128 .. 127 1 byte
Integer -32768 .. 32767 2 bytes
Longint -2147483648.. 2147483647 4 bytes
Byte 0 .. 255 1 byte
Word 0 .. 65535 2 bytes

Description example:

VAR n1, n2: Integer ; n3, n4: Word; n5, n5: Byte;

The following operations can be performed on integer operands:

addition, subtraction, multiplication, division, integer division, obtaining the remainder of division, etc.
Posted on ref.rf
Signs of these operations:

+ – * / div mod

The result of these operations on integer operands is a value of integer type, except for the division operation /. The result of division is always of real type. The result of performing the integer division operation div of integer values ​​is whole part private The result of the operation of obtaining the remainder of the division mod is the remainder of the division of numbers. Eg:

17 div 2 = 8, 3 div 5 = 0

17 mod 2 = 1, 3 mod 5 = 3.

Left shift shl and right shift shr operations:

I shl N; I shr N.

These operations shift the binary sequence of the value I left or right by N binary digits. In this case, the bits that go beyond the bit grid are lost, and the freed binary bits are filled with zeros. When shifting negative values ​​to the right, the vacated bits are filled with ones.

Relational operators applied to integer operands produce a Boolean result of TRUE or FALSE (true or false).

The PASCAL language has the following relational operations: equality =, inequality<>, greater than or equal to >=, less than or equal to<=, больше >, less< .

The following standard (built-in) functions are applicable to arguments of integer type, the result of which is of integer type:

Abs(X) – absolute value, module X;

Sqr(X) – X squared;

Succ(X) – next value (X+1);

Pred(X) – X–1.

The following group of standard functions for an integer type argument produces a real result:

Sin(X), Cos(X), ArcTan(X), Ln(X), Exp(X), Sqrt(X).

These functions calculate the sine, cosine and arctangent of an angle given in radians, the natural logarithm, the exponential and the square root, respectively.

The result of executing the Odd(X) function for checking whether an integer value is odd is true if the argument is odd, and false if the argument is even:

X=5 Odd(X)=TRUE ; X=4 Odd(X)=FALSE.

For fast work procedures with integers are defined:

Dec(X,N) X:=X–N

Real types defines those data that are realized by a subset of real numbers acceptable in a given computer.

Description example:

VAR n1, n2, n3, n4: Real;

The following can be done on real operands: arithmetic operations, giving a real result:

addition + , subtraction , multiplication * , division / .

All relational operations that produce a Boolean result are applicable to real-type quantities.

One of the operands involved in these operations must be an integer.

Functions that produce a real result are applicable to real arguments:

Abs(X), Sqr(X), Sin(X), Cos(X), ArcTan(X), Ln(X), Exp(X), Sqrt(X), Frac(X), Int(X), Pi.

The function Frac(X) returns fractional part X, function Int(X) – the integer part of X.

The no-argument function Pi returns the value of the number Pi = 3.1415926... of real type.

The functions Trunc(X) and Round(X) that produce an integer result are also applicable to arguments of real type. The first of them selects the whole part of the real argument by cutting off the fractional part, the second rounds the argument to the nearest integer.

Boolean type defines those data that can take logical values: False (false) or True (true).

Description examples:

b1, b2, b3, b4: boolean;

Examples of value assignment:

b1:= True; b2:= False; b3:= not b1;

The following logical operations apply to Boolean operands:

The boolean type is defined such that FALSE< TRUE. Это позволяет применять к булевским операндам всœе операции отношения.

TOPIC 5. Programming linear algorithms

Target laboratory work: learn to describe variables, use the assignment operator, operations and functions in programming to solve problems on linear algorithms.

Standard data types - concept and types. Classification and features of the category "Standard data types" 2017, 2018.

In textbooks on programming languages, a variable is most often defined as a “name” - “value” pair. The name corresponds to the address (link) to the memory area allocated to the variable and the value is the contents of this area. The name is the identifier, and the value corresponds to the type of the variable, which defines the set of valid values ​​and the set of operations for which the variable can serve as an operand. The set of valid values ​​for a variable is usually the same as the set of valid constants of the same type. Thus, real, integer and character variables are introduced, with character (char) sometimes referred to as integers. Integer and real are considered arithmetic types. An arithmetic (including character) type is a special case of scalar types. In addition to arithmetic types, scalar types include pointers, references, and enumerations. Variables are typed using definitions and descriptions. Unlike the description, the definition not only introduces an object (for example, a variable), but also assumes that, based on this definition, the compiler will allocate memory for the object (variable).

INTEGER TYPES define constants, variables and functions, the values ​​of which are realized by the set of integers allowed in a given computer.

Type value range required memory Shortint -128 .. 127 1 byte Integer -32768 .. 32767 2 bytes Longint -2147483648 ..2147483647 4 bytes Byte 0 .. 255 1 byte Word 0 .. 65535 2 bytes

The following arithmetic operations can be performed on integer operands: addition, subtraction, multiplication, division, obtaining the remainder of division. Signs of these operations:

+ - * div mod

The result of an arithmetic operation on integer operands is a value of integer type. The result of the operation of dividing integers is the integer part of the quotient. The result of the operation of obtaining a remainder from division is the remainder from division of integers. For example:

17 div 2 = 8, 3 div 5 = 0. 17 mod 2 = 1, 3 mod 5 = 3.

Relational operators applied to integer operands produce a Boolean result of TRUE or FALSE (true or false). The PASCAL language has the following relational operations: equality =, inequality<>, greater than or equal to >=, less than or equal to<=,больше >, less< . К аргументам целого типа применимы следующие стандартные (встроенные) функции, результат выполнения которых имеет целый тип:

Abs(X), Sqr(X), Succ(X), Pred(X),

and which determine the absolute value accordingly X, X squared, X+1, X-1. The following group of standard functions for an integer type argument produces a valid result:

Sin(X), Cos(X), ArcTan(X), Ln(X), Exp(X), Sqrt(X).

These functions calculate the sine, cosine and arctangent of an angle given in radians, the natural logarithm, the exponential and the square root, respectively. The result of executing the function of checking an integer value for odd parity Odd(X) is TRUE if the argument is odd, and FALSE if the argument is even:

X=5 Odd(X)=TRUE , X=4 Odd(X)=FALSE.

To quickly work with integers, the following procedures are defined:

REAL TYPES defines those data that are realized by a subset of real numbers allowed on a given computer.

Type Value range Quantity Required mantissa digits memory (bytes) Real 2.9e-39 .. 1.7e+38 11 6 Single 1.5e-45 .. 3.4e+38 7 4 Double 5.0e-324 .. 1.7e+308 15 8 Extended 3.4e-4932 .. 1.1e+4932 19 10 Comp -9.2e+18 .. 9.2e+18 19 8

Type Real is defined in standard PASCAL and is not supported by the math coprocessor. The remaining valid types are defined by the IEEE 457 standard and are implemented on all modern computers. To use them if you have a coprocessor or when working on an 80486 type computer, you must compile the program with the key ($N+), and in the absence of a coprocessor - with keys ($N-,E+). Type Comp Although it is a real type, it only stores long integer values. The following arithmetic operations can be performed on real operands to produce a real result:

addition +, subtraction -, multiplication *, division /.

All relational operations that produce a Boolean result are applicable to real values. One of the operands involved in these operations may be an integer. Functions that produce a real result are applicable to real arguments:

Abs(X), Sqr(X), Sin(X), Cos(X), ArcTan(X), Ln(X), Exp(X), Sqrt(X), Frac(X), Int(X), Pi.

Function Frac(X) returns the fractional part X, function Int(X)- the whole part X. No-argument function Pi returns a real pi value. Functions also apply to real type arguments

Trunc(X) and Round(X),

giving a whole result. The first of them selects the whole part of the real argument by cutting off the fractional part, the second rounds the argument to the nearest integer.

BOOLEAN TYPE (Boolean) defines those data that can accept Boolean TRUE values and FALSE. The following logical operations apply to Boolean operands:

not and or xor.

The boolean type is defined such that FALSE< TRUE. Это позволяет применять к булевским операндам все операции отношения. В ТУРБО ПАСКАЛЬ введены еще разновидности логического типа: ByteBool, WordBool и LongBool, которые занимают в памяти ЭВМ один, два и четыре байта соответственно.

IN in this example variables declared a, b And With. They belong to the logical type.

The following operations are provided for comparing logical data: Less than (<); Меньше или равно (<=); Равно (=); Не равно (<>); Greater than or equal to (>=); More (>); The following operations are allowed on logical data: Logical addition (or); logical multiplication (and); Logical negation (not); Table for calculating the result of a logical expression:

A true true false false B true false true false not A (B) false (true) false (true) true (false) true (false) A or B true true true false A and B true false false false

CHARACTER TYPE (Char) defines an ordered set of symbols acceptable on a given computer. The value of a character variable or constant is one character from the valid set. A character constant can be written in the program text in three ways: as a single character enclosed in apostrophes, for example:

"A" "a" "Yu" "yu";

Using a construction like #K, Where K- code of the corresponding symbol, and the value K must be within 0..255; using a construction like ^C, Where C- code of the corresponding control character, and the value C must be 64 more than the control character code. All relational operations are applicable to values ​​of character type. Two conversion functions are defined for character type values

Ord(C) Chr(K).

The first function determines the sequence number of the character WITH in a set of characters, the second is determined by the serial number TO symbol standing on K-ohm place in the character set. The sequence number has an integer type. Functions are applied to character type arguments that determine the previous and subsequent characters:

Pred(C) Succ(C). Pred("F") = "E" ; Succ("Y") = "Z" .

If there is no preceding or following character, the meaning of the corresponding functions is undefined. For characters from the interval " a".."z" function applicable UpCase(C), which converts these characters to uppercase "A."."Z".

The following are used to define and describe variables of the main types: keywords, each of which individually can act as a type name:

char(character); short(short whole); int(whole); long(long whole); float(real); double(double precision real); void(no meaning).

When defining variables, they can be assigned initial values, which are entered into the memory allocated for them during the initialization process. Examples of definitions (descriptions with initialization):

Char newsimbol = '\n' ; long filebegin = 0L; double pi = 3.1415926535897932385;

Several function words can be used simultaneously in a type designation. For example, the definition

Long double zebra, stop;

introduces variables with names zebra And stop high-precision real type, but does not explicitly assign any values ​​to these variables. Function words used both separately and together with other type names unsigned And signed For an arithmetic or symbolic type, you can choose how to take into account the sign bit:

Unsigned int i, j, k; // Values ​​from 0 to 65535 unsigned long L, M, N; // Values ​​from 0 to 4294967295 unsigned char c, s; // Values ​​from 0 to 255

With this definition, the variables i, j, k can only take positive integer values ​​in the range from 0 to 65535, etc. Application in definitions of types of individual function words int, char, short, long equivalent signed int, signed char, signed short, signed long. That is why function word signed is usually omitted from definitions and descriptions. Using only one type when specifying unsigned equivalent unsigned int. When operating with unsigned ( unsigned) there are no overflows with integers, since arithmetic modulo 2 to the power is used n, Where n– the number of bit bits allocated to represent the corresponding values. Variables of the same type occupy the same number of units (bytes) in memory, and this number of units can always be calculated using the operation sizeof.

Literature

  1. Nemnyugin, S.A. TURBO PASCAL: Workshop.-St. Petersburg: Peter, 2003.-256p.
  2. Podbelsky, V.V. Language SI ++: Textbook. manual.-5th ed.-M.: Finance and Statistics, 2003.-560 p.

Any objects, i.e. Constants, variables, function values ​​or expressions are characterized in Pascal by their types. A type defines the set of valid values ​​for an object, as well as the set of operations that are applicable to it. In addition, the type determines the format of the internal representation of data in the computer memory.

Pascal is characterized by a branched structure of data types:

Simple types.
Simple types include ordinal and real types.

Ordinal types are different in that they each have a finite number of possible values. These values ​​can be ordered in a certain way and, therefore, each of them can be associated with some integer - the ordinal number of the value.
Pascal has the following ordinal types:

Integer is an integer type that is an implementation-defined subset of the set of integers. In internal representation it occupies 2 bytes, the range of possible values ​​is from -32768 to +32767, the data is represented accurately.

Char is a character type that is an implementation-defined set of characters. In its internal representation, it occupies 1 byte; the set of values ​​of this type is fixed and ordered. All characters are considered renumbered, starting from zero. This character set is defined in every computing system. It is necessary at least to communicate the system with outside world.
A character type constant is one of the valid characters, taken as apostrophes. If the apostrophe itself is a symbol, then the apostrophe, which is the value of the constant, is written twice, for example '7', '+', 'F', '''', 'j', '?'.

Boolean is a logical type that defines a range of logical values ​​that contains two elements False (false) and True (true). In internal representation it occupies 1 byte.

An enumerated type is specified by listing the values ​​that it can receive. Each value is named by some identifier and is located in a list surrounded by parentheses, for example:
Type colors = (red, white, blue, black);

Type-range - a subset of its own basic type, which can be any ordinal type, except the range type. A range type is defined by the boundaries of its values ​​within the base type
<минимальное значение> . .<максимальное значение>
When determining a range type, you must follow the following rules:
-".." are treated as one character, so spaces between periods are not allowed;
- the left border should not exceed the right border.

Example: Type month = 1 ..12;
lat = 'a' .. 'z';

Real a type, strictly speaking, also has a finite number of values, which is determined by the format of the internal representation of a real number. However, the number of possible values ​​of a real number is so large that it is not possible to assign an integer to each of them.

Real - real type, is an implementation-defined subset of the set real numbers. In internal representation, it occupies 6 bytes, the range of possible values ​​is from 2.9E-39 to 1.7E+38, the accuracy of data representation is 11...12 significant digits.

Note. The Turbo Pascal programming system defines several additional simple data types for integer and real values. They differ in their ranges of values ​​and the size of the memory they occupy. Information about them is presented in the following tables.

Whole numbers

Operations.

The table shows the arithmetic operations that are defined for the integer and real types:

The following logical operations are defined in Pascal:

Not - logical NOT;

And - logical AND;

Or - logical OR;

Xor - exclusive OR.

These operations are defined as follows

P Q Not P P And Q P Or Q P Xor Q
True True False False True False True False False False True True True False False False True True True False False True True False

The following relational operators are used in Pascal: =,<>, >, <, <=, >=. Comparison operations apply to data of simple types. You can compare values ​​of the same type with each other: integer, real, character, logical, values ​​of an enumerated type. It is also possible to compare integers and real numbers with each other.
When calculating expressions of any type, the priority of calculations is determined by the parentheses placed, and in their absence, by the following table (in descending order of priority).

When designing and manufacturing various products, information about the properties of substances and materials is required. Such information was gleaned from reference books or other regulatory and technical documentation, which quickly become outdated.

To ensure the reliability of the data used in the design, the State System of Standard Reference Data (GSSSD) was created and is functioning:

The main objectives of this service are:

    establishing exact values ​​of physical constants;

    development of reliable data on the properties and composition of substances and materials;

    reliability assessment, certification and standardization of data;

    coordination of work to obtain reliable data;

    unification of the use of data and forms of their presentation;

    development of uniform principles of symbols, terminology and coding of names of substances, materials and properties;

    creation of an automated system of scientific and technical information about physical constants and properties of substances and materials;

    information services for the national economy of the country with reliable data through publications and using automated systems.

Data on the properties of substances and materials are divided into three categories:

    standard reference data (SRD) - reliable data on the physical constants and properties of the most important substances and materials, with the highest accuracy and approved by Gosstandart;

    reference (information) data (SD) – data on the properties of substances and materials, presented in numerical, graphical or analytical form, the reliability of which has not been assessed by the SSSSD bodies.

SSD and RSD are intended for use in regulatory and technical documentation of all types, in scientific research, as well as in calculating parameters that determine the performance, efficiency, reliability and operational characteristics of devices, structures, structures, technological processes, etc.

Reference data is used for the development of SDS and RSD, and can also be used in all types of national economy in the absence of corresponding SDS and RSD.

The basis of standard reference data is data produced by individual authors and usually published in the form of articles. The task of the GSSSD is to summarize this information, determine its reliability and then transfer it from the SD category to the RSD and SSD categories. Standard and recommended reference data are presented in the form of “SSD and RSD Tables” - special documents approved by Gosstandart or the All-Union Scientific Research Center of the State Service of Standard Reference Data (VNITs GSSSD).

All this work is coordinated by Gosstandart and is one of the important conditions for metrological support.

List of used literature

    “Standardization and product quality management”, Romanov.

    “Methods for assessing the effectiveness of certification”, F. A. Amirzhagrents.

    “Fundamentals of standardization, certification and metrology”, I. M. Lifits.

    “Metrology, standardization and certification”, Radkevich, Skhirtladze.

    “Metrology”, A. G. Sergiev, V. V. Krokhin.

    “Interchangeability, standardization and measurement technology”,

By a recognized authority, data relating to a property of a material object or phenomenon or a system of components of known composition or structure, obtained from an identified source, critically evaluated and justified in accuracy.

National

In Russia, standard reference data for the values ​​of physical constants and indicators of the properties of substances and materials are determined by the State Service for Standard Reference Data and approved by the Federal Agency for Technical Regulation and Metrology.

Interstate

In the USSR there were two types of reference data:

  • recommended reference data (RSD) - reliable data on the properties of substances and materials, certified by the bodies of the State System of Standard Reference Data (GSSSD), the accuracy of which satisfied the requirements of the national economy;
  • standard reference data (SRD) - reliable data on the physical constants and properties of the most important substances and materials, which had the highest accuracy and were approved by Gosstandart.

SSD were mandatory for use in all sectors of the national economy. The use of RSD was recommended.

In 1992, within the CIS, a decision was made and updated in 2006 to recognize previously adopted existing reference data as interstate.

An example of standard reference data accepted in the USSR (currently interstate):

  • GSSSD 55-83 "Tables of standard reference data. Steels for hot and cold rolling rolls. Mechanical and thermophysical characteristics."
  • GSSSD 98-86 - Water. Specific volume and enthalpy at temperatures 0...800 °C and pressures 0.001...1000 MPa.

Notes

  1. RMG 29-2013 GSI. Metrology. Basic terms and definitions of paragraphs. 8.22, 8.23
  2. Decree of the Government of the Russian Federation of August 20, 2001 N 596 On approval of the Regulations on the State Service of Standard Reference Data on Physical Constants and Properties of Substances and Materials
  3. GOST 8.310-78 State system for ensuring the uniformity of measurements. State Standard Reference Data Service. Main provisions of clause 3.1