Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Program construction consideration principles.doc
Скачиваний:
3
Добавлен:
04.11.2018
Размер:
72.19 Кб
Скачать

Scalar types

The scalar types are those having monolithic values. The discrete and the real types are scalar types.

The values of scalar type are put in order in the range and for it, the relation operations are predefined. They have upper and lower boundaries of the value range.

Discrete types

The discrete types have the sequence of values with minimum and maximum values. The value which is not the last one has the next value, and the value which is not the first one has the previous value. To find previous and next values, special functions are provided.

Discrete range is the sequence of values with maximum and minimum values and functions of previous and next value definition.

Discrete types are the types having discrete range.

Integer and enumerated types are discrete.

Integer type

This type consists of values, which are called the integers numbers.

The images of integer values are known as integers numbers images. For example, 1, 8, 65, 3458.

For the integer types, arithmetic standard operations, relation operations, and base operations are predefined.

Enumerated type

This type consists of values which are obviously enumerated.

The character and the boolean types are enumerated types.

Character type

The character type is the one which values are enumerated in standard environment, in the ASCII table.

This type consists of 128 ordered values.

Value images of the character type are the images of characters, which are well known. These characters are put in quotes to distinguish the character images from others denotations and digital images. For example, “c”, “t” are the character type values denotations. For the character type values the base and standard operations are predefined.

Boolean type

This type is represented by two values which images are FALSE and TRUE.

These values are ordered in such a way that FALSE is less than TRUE. FALSE and TRUE are literal images of the boolean type.

For boolean type values, relation operations are predefined.

Real types

Values of these type are approximated representations of real numbers. These numbers are represented by a decimal fraction of the following kind:

N + 0. D1, D2... Dk,

where N is an integer, Di  {0, 1... 9}.

Such a kind of representation means that if the value of k is positive, the following inequality is true.

N + D1/10 + D2/100 +... + Dk/10k < x < N + D1/10 + D2/100 +... + Dk/10k + 1/10k...

Real values representation

Two ways of representation are used for value images of the real type:

1.The real type image consists of two parts. The first part (k) is located before the comma. The second part (l) is located after the comma. Thus, the value image is “k, l” and it has the length Lt = Lk + Le where Lt is the value image length, Lk is the K part length, Le is the E part length.

For example, 252,32 is the real type image.

Real values representation

2. The value image is represented in a semi logarithmic type.

It is x = m * bl,

where

m is the mantissa,

b is the base number adopted of the value image (binary, octal, decimal, hexadecimal),

l is the order.

For example, 0.2*102 is the real type image.

Machine-dependent types

In some programming languages (Pascal, Модула-2, C), machine-dependent types are provided. Machine-dependent types are divided into two groups: machine-word and address.

Machine-word types

The machine-word type values are interpreted as the sequence of digits (bits) 0 and 1. For example, in the Modula-2 language, the “byte” and “word” machine-dependent types are provided. Only the assignment statement is provided for machine-word types. But in the Pascal language, the byte and word values are referred to as the unsigned integer values.

Address type

The values of the address types are the addresses. The addressing modes can be different in different computers and operation systems. Thus, the addresses are the machine-dependent type values.

The word type value for the address representation is used in the operation system MS –DOS. The value has the length of 4 bytes. The first two bytes are called the segment address (SEG), and the second two bytes are called the offset (OFS).

The address representation in the MS-DOS operating system is based on the memory being divided into segments at the length of 64 KB, and they have the segment addresses, while the offset addresses point the offsets inside the segment. For example, the address value image as the hexadecimal value is as follows:

$ 0040: $ 0049

SEG OFS

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]