Presentation of information in computer memory. Data representation in computer memory

To represent information in the computer memory
(both numeric and non-numeric)
a binary encoding method is used.
An elementary memory cell of a computer has a length
8 bits (byte). Each byte has its own number
(it is called an address).
The largest sequence of bits that
The computer can process as a whole,
called a machine word.

Bit numbering in a two-byte machine word

Bit # 15 is considered high
bit # 0 is the least significant.
The length of a machine word depends on the bit depth
processor and can be equal to 16, 32 bits and
etc.

Text characters (letters, numbers, signs) are coded by combinations
of zeros and ones. To every character that can
use in text, mapped to binary.
Using a 1-bit code, you can encode only 2 different
symbol.
There can be 4 two-bit combinations (00; 01, 10, 11) i.e. 22.
Three-bit combinations - 8 (23).
To encode 32 (25) different characters, 5 bits are enough.
This code was used in the work of the telegraph in the 20s of the XX century,
instead of punctuation marks, TCA and ZPT were used.
Using 7 bits, 128 characters can be encoded (binary
seven-bit code of information exchange KOI-7).

Presentation of text information in computer memory

The optimal number of characters that
used when typing various texts,
about 200 (Latin and Russian letters,
uppercase and lowercase, punctuation marks,
numbers, math signs, elements
pseudographics).
In the 2nd s.s. as many characters can be
encoded with a sequence of 8 bits
(28 \u003d 256), i.e. 1 byte.

Presentation of text information in computer memory

The most famous 8-bit encoding is the table
ASCII (American Standard Coding for Information
Interchange is the standard American code for
exchange of information).
It consists of 2 parts: the main one, the same in everything
world (decimal codes 0-127 are control
codes, Latin letters, punctuation marks, numbers) and
extended (codes 128-255 are letters
national alphabet, pseudo-graphic symbols).
The first 32 codes are control characters: return
carriages, tabs, undo, etc.

Presentation of text information in computer memory

In addition to the eight-bit character coding system
(text) information system developed
sixteen-bit character encoding, which
received the name universal, UNICODE.
This system makes it possible to encode 216 \u003d 65 536 different
characters, including almost all alphabets of the languages \u200b\u200bof our
planets.
Calculating the amount of text information is reduced to calculating
the product of the number of characters in the text by the number of digits
the binary code required to encode one character.

Representation of numbers in computer memory

Mixed BCD "system
reckoning "
Each decimal place is stored in a nibble (4 bits).
Decimal digits 0 through 9 are represented
binary numbers from 0000 to 1001.
For example packed decimal format for
storing integers with 18 significant digits
occupies 10 bytes in memory (the oldest of which
signed), uses the binary-decimal system
coding.

Representation of numbers in computer memory

Fixed point format
Used to store integers
15
14 ……………………………….0
Sign
Digits of numbers
1 bit
15 bit
The most significant bit (# 15) can be considered signed. When
if it stores 0, then this is +,
if 1, then it is.
The digital digits of a number are stored in the complementary
code (DC).

Representation of numbers in computer memory

Additional code (DC)
Used to store negative integers and
allows subtraction through addition.
The concept of complementary code exists in any system
reckoning.
DC is obtained by subtracting this negative
number from the minimum number in which the digits on
one more.
Let's consider the principle of using additional code
on the example of decimal s.s.

The principle of operation of the additional code on the example of 10 pp.

Let it be necessary to calculate: 8810 - 6410
Such familiar to us notation of numbers is a direct code (PC) of numbers.
Let's perform the subtraction through the addition of numbers in the DC.
1) Let's translate the numbers into DC. For the number 88, DC is the same as PC.
So for all numbers that are greater than 0.
For the number -64 (it's less than 0), subtract 64 from the minimum
a three-digit number (since there are two digits in the number 64, then this is 100):
100 - 64 \u003d 36 - this is the DK of the number 64.
2) Now add the DK numbers: 88 + 36 \u003d 124.
If we discard the most significant bit, then we get 24, which
corresponds to the result of the subtraction.

DC for negative binary numbers
it turns out easier. Need to view
writing binary code from right to left and before
the first available unit inclusive
leave the digits unchanged. After this
units, all 0 are replaced by 1, and 1 by 0.

Representation of numbers in computer memory
(fixed point format)
Example 1. Write down the number -40 (10) in computer format as a signed integer.
The bit format is 16 bits.
Decision.

40(10) = 101000(2)


0000 0000 0010 1000
3) We get the DC by looking at the PC from right to left
PC: 0000 0000 0010 1000
DK: 1111 1111 1101 1000
This is a binary notation of the computer representation of the number -4010 in the format
computer with a fixed point of 16 bits.
For a more compact notation, use the hexadecimal code: FFD8 (16)

Representation of numbers in computer memory (fixed point format)

Example 2. Write the number 40 (10) in computer format as an integer with
familiar. The bit format is 16 bits.
Decision.
1) We translate 40 (10) into a binary number system:
40(10) = 101000(2)
2) Get PC numbers in computer format. For this we supplement
binary notation of the number on the left with zeros so that there are 16 bits:
0000 0000 0010 1000
The resulting PC coincides with the DC, since the number is positive.
Therefore, this binary notation is the computer representation
numbers 4010 in fixed-point computer format
bit width.
For a more compact notation, use a hexadecimal code:
0028(16)
You cannot omit insignificant zeros here, since they are stored in
computer memory.

Representation of numbers in computer memory (fixed point format)

Another way to get DC is to get the reverse
(inverse) code (OK), and then add 1 to it.
Example 3. Let us write down the DC of the number (–38), interpreting it
as a fixed point value
32-bit:
1) Digit 38 pcs:
0000 0000 0000 0000 0000 0000 0010 0110;
2) OK numbers -38 (here 0 is replaced by 1, and 1 by 0):
1111 1111 1111 1111 1111 1111 1101 1001;
3) DC is obtained by adding units to OK:
1111 1111 1111 1111 1111 1111 1101 1010
or FFFFFFDB (16).

Representation of numbers in computer memory (fixed point format)

Example 4. A number is given in computer format (16 bit): FFD4 (16). Define
decimal value of the number.
Decision.
1) Let's write the binary code of the number:
FFD4 (16) \u003d 1111 1111 1101 0100 (2)
2) Let's select the format elements:
1 111 1111 1101 0100
sign Digital digits
3) Since the sign bit is 1 (this is -), the digital digits are written in
DC. We will get a PC according to the same rule by which we received DC:
DK: 1111 1111 1101 0100
PC: 0000 0000 0010 1100
4) We translate the PC into 10 s.s.: 32 + 8 + 4 \u003d 44 (10)
5) Recall that the sign is. So the answer is -44 (10)

Any real number can be written in standard form
(sometimes the record is called a scientific record):
M 10p, where 1 M< 10, p - целое.
For example, 120100000 \u003d 1.201 108.
Since each decimal position is different from
adjacent by a power of 10, multiplication by 10 is equivalent to
shift the decimal point one position to the right.
Similarly, division by 10 shifts the decimal point by
position to the left.
Therefore, the example can be continued:
120100000 = 1,201 108 = 0,1201 109 = 12,01 107 .
It turns out that the decimal point "floats" in the number and more
does not mark the absolute place between whole and fractional
parts.

Representation of numbers in computer memory (floating point format)

Consider the record M 10 p.
Here: M is the mantissa of the number, p is the order of the number.
To keep maximum precision, in memory
the computer's mantissa is stored in a normalized form.
It means that:
1 M< 2.
This way of storing a floating point mantissa
implies binary comma is on
fixed place: a binary comma follows
the first significant binary digit. This means that in
the integer part is always 1 in the normalized mantissa.
Then its value lies between one and two.

Representation of numbers in computer memory (floating point format)

Let's consider the format of a real number. For him may
allocated 4, 6, 8, 10 and other bytes. DC is not used.
Floating-point space is divisible by
three fields: sign (most significant bit), place to store the order
and a place to store the mantissa. For a 4 byte format:
31 30 … … … 23 22…………………….0
Sign Offset
order
1 bit
8 bit
Mantissa
23 bits

Representation of numbers in computer memory (floating point format)

The displaced order is the order to which
added constant (called offset
order) corresponding to the bitness of the format.
This allows you not to use the DC.
The offset is chosen so that the minimum value
the order corresponded to zero. For example, for 8 byte format
the order is 11 bits and has a range from 2-1023 to 21023,
so the offset is 1023 (10) \u003d 11 1111 1111 (2) \u003d 3FF (16).

Representation of numbers in computer memory
(floating point format)
Order offset table for formats with
floating point
Bit depth
format, bit
Bit depth
order, bit
Order offset
10 s.s.
16 s.s.
32
8
127
7F
64
11
1023
3FF
80
15
16383
3FFF

Representation of numbers in computer memory
(floating point format)
Algorithm for obtaining a representation of a real number in
computer memory:
1) convert the modulus of a given number to the binary system
reckoning;
2) normalize a binary number i.e. write as M 2p,
where M is the mantissa (its integer part is equal to 1) and p is the order,
written in decimal notation;
3) add the offset to the order and translate the offset
order in binary number system;
4) taking into account the sign of the given number (0 - positive; 1 -
negative), write out its representation in memory
computer. At the same time, throw out a whole from the mantissa
part, because it is always 1.

Representation of numbers in computer memory
(floating point format)
Example 1. Write down the number –312.3125 (10) in the format
floating point computer with a size of 4 bytes (32
bit).
Decision.
1) Binary record of the modulus of this number: 100111000,0101.
2) Normalize the number, i.e. carry the comma so that
in the whole part there was one 1. We have:
100111000,0101 = 1,001110000101 28.
3) Get the shifted order by adding to the order
offset for 32-bit format (12710 or 7F16).
It is more convenient to perform actions in the 16th s.s.:
810 = 10002 = 816
816 + 7F16 \u003d 8716 \u003d 1000 01112.

Representation of numbers in computer memory (floating point format)

4) Let's write out the format elements:
Sign:
Characteristic:
Mantissa:
1 (since the number is less than 0)
1000 01112
0011100001012 (we don't take the whole part)
5) "Collect" format elements:
1 10000111 001110000101 - only 21 digits, but you need 32.
6) Add 11 more zero digits to the right, because it will be
insignificant zeros:
1100 0011 1001 1100 0010 1000 0000 00002
This is a record of the answer in the 2nd pp. For a more compact recording
we use the 16th s.s.:
C39C2800

Representation of numbers in computer memory (floating point format)

Example 2. Given a real number C1040000 in
floating point size 4 computer
bytes (32 bits). Determine the decimal value of the given
numbers.
Decision.
1) Binary notation of this number:
1100 0001 0000 0100 0000 0000 0000 0000
2) Select the format elements:
Sign:
1 (i.e. the number is negative)
Displaced order: 1000 0010 or 8216
Mantissa: 000 0100 0000 0000 0000 0000

Representation of numbers in computer memory (floating point format)

3) Get the order by subtracting the offset from 8216 for
32-bit format:
8216 - 7F16 \u003d 316
4) We get the mantissa - the integer part is equal to 1, and the fractional part
take from the format, discarding insignificant zeros:
1, 00001
5) We write down the binary number in normal form:
-1,000012∙23
6) The order says that the comma must be shifted by 3
discharge to the right:
-1000,012 = - (8+1/4) = -8,2510

Representation of numbers in computer memory (floating point format)

Floating point format features
If, when calculating with real numbers, the result comes out
out of range, then program execution
is interrupted. This happens, for example, when dividing by zero, or
by a very small number, close to zero.
Real numbers, the bit width of the mantissa of which exceeds
the number of bits allocated for the mantissa in memory are represented by
in a computer approximately (with a “cropped” mantissa). For instance,
the rational decimal number 0.1 in the computer will be represented
approximate (rounded off), because in the binary number system
his mantissa has an infinite number of digits. The consequence of such
approximation is the error of machine calculations with
real numbers.
Calculations with real numbers are performed by the computer
approximately. The error of such calculations is called
the error of machine calculations.
The set of real numbers exactly representable in memory
floating-point computer is limited and
discrete. Their number can be calculated.

Consider raster graphics.
To encode any image, it is split into
dots and the color of each dot to encode.
For example, a black and white picture can be encoded,
using two bits: 11 for white, 10 for light gray, 01 for dark gray, and 00 for black.
It takes 8 bits to encode 256 different colors.
To encode full color images into
modern computers for storing one color
points use 3 bytes.

Presentation of graphic information

Color graphic information coding system
RGB
(Red, Green, Blue)
Each color is a combination of three color
components: red, green and blue. First byte
determines the intensity of the red component, the second
- green, third - blue.
White is coded with the maximum intensity of all
three components (255, 255, 255 or in the 2nd s.s. 111111111,
11111111, 11111111). Black is the absence of all
color components - (0,0,0). Red can
be dark - (120,0,0) or bright red (255,0,0).
RGB system provides unambiguous definition 16.5
million of different colors and shades (224).

Presentation of graphic information

The quality of the graphic also depends on
the number of points (pixels) per unit area. This
the parameter is called resolution and is measured in points
per inch - dpi.
The calculation of the amount of graphic information is reduced to
calculating the product of the number of points in
image by the number of bits required to
single point color encoding.
For example, for a color picture 640 × 480,
composed of 256 colors, you need:
8 640 480 = 23 64 10 6 8 10 = 23 26 2 5 2 3 23
2 5 \u003d 210 5 25 3 5 \u003d 22 75 23 210 bits \u003d 4 75 KB
\u003d 300 KB.

Presentation of graphic information

The number of colors displayed on the screen (K) and
the number of bits allocated for each pixel (N),
related by the formula:
K \u003d 2N
Number of bits N allocated for each pixel
called bit depth.

The sound wave is converted to binary with
using a sound card (audio adapter).
During audio recording, the audio adapter with
a certain period measures the amplitude
electric current and registers
binary code of the obtained value.
Then the resulting code from the register is rewritten
into the computer's RAM. Quality
computer sound is determined
audio adapter characteristics: frequency
sampling and bit depth.

Presentation of audio information

The sampling rate is the number
measurements of the input signal in 1 second.
Measured in hertz (Hz).
One measurement per second corresponds to the frequency
1 Hz.
1000 measurements per second corresponds to the frequency
1 kHz (kilohertz).

Presentation of audio information

The width of the register is the number of bits in
the audio adapter register. She defines
measurement accuracy of the input signal. Than
the more bit depth, the less the error
of each individual transformation of the quantity
electrical signal to a number and back.
If the bit width is 8, then when measuring the input
signal can be received 256 different
values. Obviously, the more bit depth
audio adapter, the more accurately reproduced
sound.

Presentation of audio information

Example. Determine the size of V in digital bytes
audio file, playing time t \u003d 10 seconds at
sampling rate ν \u003d 22.05 kHz and resolution i \u003d 8
bit. The file is not compressed.
Decision.
Formula: V \u003d ν ∙ i ∙ t bit
22050 ∙ 10 ∙ 8/8 bytes \u003d 220500 bytes

Measurement units of information A unit of information is called a bit. The term "bit" is proposed as an abbreviation for the English phrase "Binary digit", which translates as "binary digit". 1 bit of information - the amount of information by which one of the two equally probable states of an object is allocated. In computer technology, a bit corresponds to the physical state of the data carrier: magnetized - not magnetized, there is a hole - no hole. In this case, one state is usually denoted by the number 0, and the other - by the number 1. The choice of one of the two possible options also makes it possible to distinguish between logical truth and falsehood. A sequence of bits can encode text, images, sound, or any other information. This method of representing information is called binary encoding.

Units of measurement of information In computer science, a value called byte (byte) and equal to 8 bits is often used. And if a bit allows you to choose one option out of two possible, then a byte, respectively, is 1 out of 256 (28). In most modern computers, when encoding, each character corresponds to its own sequence of eight zeros and ones, ie, bytes. Along with bytes, larger units are used to measure the amount of information: 1 KB (one kilobyte) \u003d 210 bytes \u003d 1024 bytes; 1 MB (one megabyte) \u003d 210 KB \u003d 1024 KB \u003d 220 bytes; 1 GB (one gigabyte) \u003d 210 MB \u003d 1024 MB \u003d 230 bytes. 1 TB (one terabyte) \u003d 210 GB \u003d 1024 GB \u003d 240 bytes, 1 PB (one petabyte) \u003d 210 TB \u003d 1024 TB \u003d 250 bytes.

Representation of numerical information Numerical information was the first type of information that computers began to process, and for a long time it remained the only type. Therefore, it is not surprising that there is a wide variety of types and representations of numbers in modern computers. First of all, these are integers and real numbers, which in their essence and in their representation in a machine differ very significantly. Whole numbers, in turn, are divided into signed and unsigned numbers, which no longer have such significant differences. Finally, real numbers have two ways of representing - with a fixed point and with a floating point, however, the first way is now mainly of historical interest.

Unsigned Integers Unsigned integers are the easiest machine to represent. To do this, it is enough to translate the required number into binary form and supplement the resulting result with zeros on the left to the standard bit width. For example, an eight-digit (1 byte) number 14 will have the form 0000 1110. This same number in 16-bit representation will have 8 more zeros on the left. It is easy to determine the minimum and maximum value of numbers for an N-bit unsigned integer: the minimum consists of all zeros, which means that for any N it is equal to zero; the maximum, on the contrary, is formed by the same units and, of course, is different for different N. To calculate the maximum allowable value, the formula is usually used: Max \u003d 2 N - 1. If you perform the following operations: 255 + 1 and 0 - 1. Imagine mentally that when performing an operation on the left, there is another additional (ninth) digit. And, discarding the non-existent additional digit, we get a somewhat strange, but actually taking place in practice result: 255 + 1 \u003d 0. A 0 -1 \u003d 255.

Overflow If you now look closely at the results obtained, you will notice that with a successive increase by one, we reach the maximum value and return to the minimum. Subtracting one gives the opposite picture. Similar properties of the behavior of numbers can be displayed instead of the traditional segment of the mathematical number axis with a closed circle. The discussed problem of going beyond the allocated bit grid of a machine takes an important place in the implementation of computer arithmetic and is called overflow. This situation is not entirely normal and should be avoided in order to obtain reliable results. The situation is complicated by the fact that for the processor the described results are not something "threatening", and it "calmly" continues the calculations. The only subtlety is that the very fact of overflow is always fixed by setting a special control bit to one, which the subsequent program can analyze. Figuratively speaking, the processor "notices" the overflow, but gives the software the right to decide whether to react to it or ignore it.

Signed integers In order to distinguish between positive and negative numbers, the sign bit is highlighted in the binary representation of numbers. Traditionally, the most significant bit is used to encode the sign, with a zero value corresponding to the "+" sign, and one - to a minus. We emphasize that from the point of view of the described coding system, the number zero is positive, since all its digits, including the signed one, are zero. The representation of positive numbers in the transition from unsigned numbers to signed integers is preserved, except that now there is one bit less for the actual number. The first thing that comes to mind is to encode negative values \u200b\u200bin the same way as positive ones, only add one to the most significant bit. This type of encoding is called straight code.

Additional code of a number It is based on writing negative numbers in the form 2 N - | m |, where N, as usual, is the number of binary digits, and m is the value of a number. Since in fact, instead of a number, its complement to some characteristic value 2 N is now written, such a code was called complementary. However, the calculation method that follows directly from the definition is not very good, since it requires an additional discharge from the processor design. Therefore, the following equivalent algorithm is used to obtain the code of negative numbers in practice. To convert a negative number into a complementary code, you need to: Convert the module of the number to binary form. Invert each bit of the resulting code, that is, replace ones with zeros, and zeros with ones (the resulting code is called inverse). Add one to the reverse code. Example 1: Convert number - 8 to binary 8 - bit code. Let's take the module of the number (8 10 \u003d 10002) and add it to the required number of digits with zeros on the left: 0000 1000. Now we will invert: 1111 0111. Add one. We will get the final answer: 11111000 To check the correctness of the translation, you can add the last number with the original one and make sure that the result will be zero (we neglect the transfer unit from the most significant digit, as usual). Let's compare unsigned and signed integers. The result of comparing signed and unsigned numbers is that the total number of their values \u200b\u200bis the same, but their ranges are shifted along the number axis.

Representation of real numbers The fundamental difference between real and integer numbers: integers are discrete, and hence (if we do not take into account the overflow effect), each integer corresponds to a unique binary code; real numbers, on the contrary, are continuous, which means that they cannot be completely correctly transferred to a computer that is discrete in nature. This means that some real numbers that differ slightly from each other may have the same code. There are two ways to represent real numbers: fixed point and floating point. In old machines, which used a fixed placement of a comma, the position of the latter in the bit grid of a computer was predetermined - once and for all for all numbers and for all technical devices. Therefore, there was no need for any way to indicate it in the internal representation of numbers. All computational algorithms were "tuned" in advance to this fixed placement.

A floating point representation of any number A in base Q can be written as: A \u003d (± M) x Q ± P. where M is called the mantissa, and the exponent P is the order of the number. For example, 0.03 \u003d 3 x 10 -2 \u003d 30 x 10 -3 \u003d 0.3 x 10 -1 \u003d 0.03 x 10 0 \u003d. ... ... That is, the floating point representation is not unique. Therefore, we agreed to select the only option for recording a number to consider that the mantissa is always less than one, and its first digit contains a nonzero digit - in our example, only the number 0.3 x 10 -1 will satisfy both requirements. The described representation of numbers is called normalized and is unique. Any number can be normalized. We emphasize that the requirements for the normalization of numbers are introduced based on considerations of ensuring the maximum accuracy of their representation.

Floating point representation Everything that has been said about normalization can also be applied to the binary system: A \u003d (± M) x 2 ± P. For example: - 3 10 \u003d - 0, 11 x 210, M \u003d 0, 11 and P \u003d 10. Essentially that the binary mantissa always starts with one. Therefore, in many computers, this unit is not recorded in RAM, which allows you to save one more additional bit of the mantissa (the so-called hidden unit). Floating point arithmetic turns out to be much more complicated than fixed point arithmetic. For example, to add two floating point numbers, you must first convert them to a representation when both orders are equal; such a procedure is called order alignment. In addition, as a result of calculations, normalization is often violated, which means that it must be restored. Nevertheless, computers are perfectly able to handle all this automatically, and it is this method of computing that underlies the work of modern computers.

Floating point representation When using the floating point method of representing real numbers, two numbers are actually stored: the mantissa and the order. The bit depth of the first part determines the accuracy of calculations, and the second - the range of representation of numbers. In order to maintain maximum accuracy, computers almost always store the mantissa in a normalized form, which means that the mantissa in this case is a number lying between 1 (10) and 2 (10) (1

Real data types Type Range Bytes float 3.4 e– 38… 3.4 e + 38 4 double 1. 7 e– 308… 1. 7 e + 308 8 long double 3.4 e– 4932… 3.4 e + 4932 10 For type double: S Displaced order Mantissa 63 62.. 52 51.. 0

Representation of floating-point numbers To simplify calculations and compare real numbers, the order value in the computer is stored as an offset number, that is, an offset is added to the real order value before writing it into memory. The offset is chosen so that zero corresponds to the minimum order value. For example, for a Double, the order is 11 bits and ranges from 2 -1023 to 21023, so the offset is 1023 (10) \u003d 11111 (2). Finally, bit 63 indicates the sign of the number. Algorithm for obtaining a representation of a real number in the computer memory: Convert the module of a given number into a binary number system; normalize a binary number, that is, write it in the form M × 2 p, where M is the mantissa (its integer part is equal to 1 (2)) and p is the order written in the decimal number system; add an offset to the order and convert the offset order to the binary number system; taking into account the sign of the given number (0 - positive; 1 - negative), write down its representation in the computer memory.

Example: Let's write down the code of the number -312, 3125. The binary record of the modulus of this number has the form 100111000, 0101. Let's normalize, we get 100111000, 0101 \u003d 1, 001110000101 × 28. Find the shifted order: 8 + 1023 \u003d 1031. Then we have 1031 (10 ) \u003d 10000000111 (2). Finally 00111000010100000000000 1 10000000111 0000000000 63 62.. 52 51.. 0 Obviously, a more compact code should be written as follows: C 0738500000 (16).

Reverse transition from the code of a real number to the number itself Let the code 3 FEC 6000000 (16) be given. First of all, we note that this is a positive number code, since zero is written in the bit number 63. We get the order of this number: 0111110 (2) \u003d 1022 (10); 1022 - 1023 \u003d -1. The number has the form 1, 1100011 × 2 -1 or 0, 11100011. Converting to the decimal number system, we get 0, 88671875.

Representation of textual information Textual information, like any other, is stored in the computer memory in binary form. To do this, each symbol is associated with a certain non-negative number, called the symbol code, and this number is written into the computer memory in binary form. The specific correspondence between characters and their codes is called an encoding system. Personal computers usually use the ASCII (American Standard Code for Information Interchange) encoding system. It was introduced in 1963 and assigns a seven-bit binary code to each character. It is easy to determine that 128 characters can be represented in ASCII code. In the ASCII system, two coding tables are fixed, basic and extended. The base table fixes the values \u200b\u200bof the codes from 0 to 127, and the extended one refers to characters with numbers from 128 to 255. The first 32 codes of the base table, starting with zero, are given to the hardware manufacturers. This area contains control codes that do not correspond to any language characters. From 32 to 127 code, codes of characters of the English alphabet, punctuation marks, arithmetic operations and auxiliary symbols are placed.

Universal coding system for text data If we analyze the organizational difficulties associated with the creation of a unified coding system for text data, we can conclude that they are caused by a limited set of codes (256). At the same time, it is obvious that if you encode symbols not with eight-bit binary numbers, but with numbers with a large bit, then the range of possible values \u200b\u200bof the codes will become much larger. Such a system, based on 16-bit character coding, is called universal - UNICODE. Sixteen digits make it possible to provide unique codes for 216 \u003d 65,536 different characters - this field is quite enough to accommodate most of the planet's languages \u200b\u200bin one character table.

Basic concepts:
bit;
binary encoding;
notation;
non-positional number system;
positional number system.

Computer memory

In order to understand how the most diverse information is presented in a computer, let's "look" inside the machine memory. It is convenient to represent it as a sheet in a cage. Each such "cell" stores only one of two values: zero or one. Two digits are convenient for electronic data storage, as they only require two states of the electronic circuit - "on" (this corresponds to the number 1) and "off" (this corresponds to the number 0). Each "cell" of computer memory is called a bit. The numbers 0 and 1 stored in the "cells" of the computer's memory are called bit values.

A variety of information can be represented using a sequence of bits. This presentation of information is called binary or digital coding.

The advantage of digital data is that it is relatively easy to copy and modify. They can be stored and transmitted using the same methods, regardless of the data type.

Methods for digital encoding of texts, sounds (voices, music), images (photographs, illustrations) and sequences of images (films and videos), as well as three-dimensional objects were invented in the 80s of the last century.

Number systems

“Everything is number,” the sages said, emphasizing the extremely important role of numbers in people's lives.

There are many ways to represent numbers. In any case, a number is represented by a symbol or a group of symbols (word) of some alphabet. Such symbols are called figures.

Notationit is a set of techniques and rules for marking and naming numbers.

People learned to count a long time ago, back in the Stone Age. At first, they simply distinguished, one object in front of them or more. After a while, a word appeared to denote two objects. As soon as people started counting, they had a need to write numbers. The finds of archaeologists at the sites of primitive people indicate that initially the number of objects was displayed in an equal number of any icons: notches, dashes, dots. So that two people could accurately store some numerical information, they took a wooden tag, made the required number of notches on it, and then split the tag in half.

Each took away his half and kept it. This technique made it possible to avoid “forgery”. Indeed, when a controversial situation arises, the halves could be added and the coincidence and the number of notches could be compared.

This system of writing numbers is called single (unary), since any number in it is formed by repeating one sign, symbolizing one.

Echoes of the unit number system are still found today. So, in order to find out in which course a cadet of a military school is studying, you need to count how many stripes are sewn on his sleeve. Without realizing it, kids use this code, showing their age on their fingers. It is the unary system that lies at the foundation of arithmetic, and it is it that still introduces schoolchildren to the world of counting.

Unit system - not the most convenient way to write numbers. Recording large quantities in this way is tedious, and the recordings themselves are very long. Over time, other, more economical number systems have emerged.

Numbers designation and counting in ancient Egypt

Around the third millennium BC, the Egyptians invented their own numerical system, in which special symbols were used to designate key numbers 1, 10, 100, and so on - hieroglyphs... Over time, these signs have changed and acquired a simpler form.

The size of the number did not depend on the order in which its constituent signs were located: they could be written from top to bottom, from right to left, or mixed.

The number system is called non-positional, if in it the quantitative values \u200b\u200bof the symbols used to write numbers do not depend on their position (place, position) in the number code.

The numeral system of Ancient Egypt is non-positional. The number 2 and its degrees played a special role among the Egyptians. They carried out multiplication and division by successive doubling and addition of numbers. Such calculations looked rather cumbersome.

Roman numeral system

An example of a non-positional number system that has survived to this day is the number system used more than two and a half thousand years ago in Ancient Rome.

The Roman numeral system is based on the signs I (one finger) for the number 1, V (open palm) for the number 5, X (two folded palms) for 10, as well as special signs for the numbers 50, 100, 500 and 1000.

The notation for the last four numbers has undergone significant changes over time. Scientists assume that initially the sign for the number 100 had the form of a bundle of three dashes like the Russian letter Ж, and for the number 50 - the form of the upper half of this letter, which was later transformed into the sign L.

For example, IX stands for 9, and XI stands for 11. Decimal 28 is represented as follows: XXVIII \u003d 10 + 10 + 5 + 1 + 1 + 1.

The fact that when writing new numbers, key numbers can not only be added, but also subtracted, has a significant drawback: writing in Roman numerals deprives the number of the uniqueness of representation.

There are still no uniform rules for writing Roman numbers, but there are proposals to adopt an international standard for them.

Nowadays, it is proposed to write any of the Roman numerals in one number no more than three times in a row. Based on this, a table has been built, which is convenient to use to designate numbers in Roman numerals.

This table allows you to write any integer from 1 to 3999. To do this, first write your number as usual (in decimal). Then, for numbers in the digits of thousands, hundreds, tens and units, select the appropriate code groups from the table.

It is a very long time to use Roman numerals. Even 200 years ago, in business papers, numbers had to be indicated by Roman numerals (it was believed that ordinary Arabic numerals were easy to forge).

The Roman numeral system is used today mainly for naming significant dates, volumes, sections and chapters in books.

Alphabetic number systems

Along with hieroglyphic in ancient times were widely used alphabetic number systems in which numbers are represented by letters of the alphabet. So, in Ancient Greece, the numbers 1, 2,…., 9 were designated by the first nine letters of the Greek alphabet: α \u003d 1, β \u003d 2, γ \u003d 3 and so on. The following nine letters were used to denote tens: ι \u003d 10, κ \u003d 20, λ \u003d 30, μ \u003d 40, and so on. The last nine letters were used to designate hundreds: ρ \u003d 100, σ \u003d 200, τ \u003d 300, and so on.

Slavic numeric alphabet

The southern and eastern Slavic peoples also used alphabetic numbering. In some Slavic peoples, the numerical values \u200b\u200bof the letters were established in the order of the Slavic alphabet, while in others (including the Russians), not all letters of the Slavic alphabet played the role of numbers, but only those of them that were also in the Greek alphabet. Above the letter denoting the number, there was a special sign - "titlo". At the same time, the numerical values \u200b\u200bof the letters increased in the same order in which the letters followed in the Greek alphabet.

In Russia, Slavic numbering was preserved until the end of the 17th century. Under Peter I, the so-called Arabic numbering prevailed, which we still use today. Slavic numbering was preserved only in liturgical books.

Yasak letters

Since the writing of numbers using the alphabetical number system was quite complicated, then in the old days in Russia, among the common people, number systems that were vaguely reminiscent of the Roman were widely used. With their help, the tax collectors filled out receipts for the payment of taxes - yasak (yasak letters) and made notes in the tax notebook.

Positional number systems

The hieroglyphic and alphabetical number systems we have considered had one significant drawback - it was very difficult to perform arithmetic operations in them. Positional systems do not have this inconvenience.

The number system is called positional, if the quantitative values \u200b\u200bof the characters used to write numbers depend on their position (place, position) in the number code.

The French mathematician Pierre Simon Laplace (1749-1827) assessed the "discovery" of the positional number system with these words: it's hard to judge how amazing she is. "

The main advantages of any positional number system are the simplicity of performing arithmetic operations and the limited number of characters required to write any numbers.

Babylonian number system

The idea of \u200b\u200bassigning different values \u200b\u200bto numbers, depending on what position they occupy in the number recording, first appeared in Ancient Babylon around the 3rd millennium BC.

Many clay tablets of Ancient Babylon have survived to our time, on which the most complex problems were solved, such as calculating the roots, finding the volume of the pyramid, etc. To write numbers, the Babylonians used only two signs: a vertical wedge (units) and a horizontal wedge (tens). All numbers from 1 to 59 were written using these signs, as in the usual hieroglyphic system. The whole number as a whole was written in the positional numeral system with base 60.

The Babylonians also had a sign that played the role of zero. They indicated the absence of intermediate discharges. But the absence of lower digits was not indicated in any way.

Decimal number system

The usual system of notation for numbers, which we are used to using in everyday life, with which we are familiar from childhood, in which we perform all our calculations, is an example of a positional number system.

In our usual number system, ten different signs are used to write numbers.... Therefore it is called decimal... Of two identical numbers written side by side, the left one is 10 times larger than the right one. Not only the number itself, but also its place, its position in the number are of decisive importance. Therefore, this number system is called positional.

It took many millennia for people to learn how to name and write numbers the way you and I do. This began in ancient Egypt and Babylon. The matter was mainly completed by Indian mathematicians in the 5th-7th centuries AD. An important achievement of Indian science was the introduction of a special designation for skipping the digits - zero. The Arabs, being the first to get acquainted with this numbering, appreciated it at its true worth, adopted it and transferred it to Europe. Having received the name Arab, this system in the XII century AD spread throughout Europe and, being simpler and more convenient than the other number systems, quickly replaced them. Today, decimal digits represent time, house and telephone numbers, prices, budget, the metric system of measures is based on them.

Arithmetic operations on decimal numbers are performed using fairly simple operations, which are based on the multiplication and addition tables known to every student, as well as the transfer rule: if the addition of two digits results in a number that is greater than or equal to 10, then it is written using several digits in adjacent positions.

Studied at a very early age, as a result of everyday practice, these rules are learned so firmly that we already operate with them subconsciously. For this reason, today many people do not even know about the existence of other number systems.

Other positional number systems

Elements of the duodecimal number system were widespread until the first half of the 20th century. The number 12 (a dozen) even competed with the ten in the struggle for the honorary post of the foundation of the commonly used number system.

But the Swedish king Charles XII in 1717 was fond of the octal system, considered it more convenient than the decimal system, and intended to introduce it as a national one by royal decree. Only the unexpected death of the king prevented the implementation of such an unusual intention.

Computer workshop

EC COR resources

Practical work No. 2
"Getting to know the word processor Word" (task 1)

Exercise 1

1. Open your word processor.

2. Find the title bar, menu bar, status bar. Using the menu View find out which toolbars are installed. Remove all unnecessary panels, leaving only panels Standard and Formatting... Remember the purpose of the buttons you already know and find out the purpose of the new buttons, lists and fields of these panels.

Data representation in the memory of a personal computer

(numbers, symbols, graphics, sound).

Form and language of information presentation

Perceiving information with the help of the senses, a person seeks to fix it so that it becomes understandable to others, presenting it in one form or another.

The composer can play a musical theme on the piano, and then write it down using notes. Images inspired by the same melody can be embodied by the poet in the form of a poem, the choreographer can express it in a dance, and the artist can express it in a painting.

A person expresses his thoughts in the form of sentences made up of words. Words, in turn, are composed of letters. This is an alphabetical representation of information.

The form of presentation of the same information may be different. It depends on the goal you have set for yourself. You come across similar operations in mathematics and physics lessons when you present a solution in different forms. For example, the solution to the problem: "Find the value of a mathematical expression ..." can be presented in tabular or graphical form by using visual means of presenting information: numbers, a table, a picture.

Thus, information can be presented in various forms:

    sign writing, consisting of various signs, among which it is customary to distinguish

    symbolic in the form of text, numbers, special characters (for example, text of a textbook);

    graphic (for example, a geographic map);

    tabular (for example, a table for recording the course of a physical experiment);

    in the form of gestures or signals (for example, signals from a traffic controller);

    oral verbal (for example, conversation).

The form of presenting information is very important when transmitting it: if a person has poor hearing, then it is impossible to transmit information to him in sound form; if the dog has a poorly developed sense of smell, then it cannot work in the search service. At different times, people transmitted information in various forms using: speech, smoke, drumming, ringing bells, writing, telegraph, radio, telephone, fax.

Regardless of the form of presentation and method of transmission of information, it is always transmitted using a language.

In mathematics lessons, you use a special language based on numbers, signs of arithmetic operations and relations. They make up the alphabet of the language of mathematics.

In physics lessons, when considering a physical phenomenon, you use special characters characteristic of a given language, from which you make formulas. Formula is a word in the language of physics.

In chemistry lessons, you also use certain symbols, signs, combining them into "words" of a given language.

There is the language of the deaf and dumb, where the symbols of the language are certain signs expressed by facial expressions and hand movements.

The basis of any language is the alphabet - a set of uniquely defined characters (symbols) from which a message is formed.

Languages \u200b\u200bare divided into natural (spoken) and formal. The natural language alphabet depends on national traditions. Formal languages \u200b\u200bare found in special areas of human activity (mathematics, physics, chemistry, etc.). There are about 10,000 different languages, dialects, adverbs in the world. Many spoken languages \u200b\u200bare descended from the same language. For example, French, Spanish, Italian and other languages \u200b\u200bwere formed from Latin.

Information coding

With the advent of language, and then sign systems, the possibilities of communication between people expanded. This made it possible to store ideas, knowledge gained and any data, transmit them in various ways over a distance and at other times - not only to their contemporaries, but also to future generations. The creations of ancestors have survived to this day, who, with the help of various symbols, immortalized themselves and their deeds in monuments and inscriptions. Rock carvings (petroglyphs) are still a mystery to scientists. Perhaps in this way the ancient people wanted to make contact with us, the future inhabitants of the planet and report the events of their lives.

Each nation has its own language, consisting of a set of characters (letters): Russian, English, Japanese and many others. You have already become familiar with the language of mathematics, physics, chemistry.

The presentation of information using a language is often called coding.

Code - a set of symbols (conventions) to represent information. Coding is the process of representing information in the form of code.

The driver transmits a signal with a beep or flashing headlights. The code is the presence or absence of a beep, and in the case of a light alarm, the blinking of headlights or its absence.

You are faced with the coding of information when crossing the road by traffic signals. The code determines the colors of the traffic light - red, yellow, green.

The natural language in which people communicate is also based on code. Only in this case is it called the alphabet. When speaking, this code is transmitted in sounds, when writing - in letters. The same information can be represented using different codes. For example, a recording of a conversation can be recorded by means of Russian letters or special shorthand symbols.

As technology developed, different ways of encoding information appeared. In the second half of the 19th century, American inventor Samuel Morse invented an amazing code that still serves humanity today. The information is encoded in three "letters": a long signal (dash), a short signal (dot) and no signal (pause) to separate letters. Thus, encoding is reduced to using a set of characters arranged in a strictly defined order.

People have always looked for ways to quickly exchange messages. For this, messengers were sent, carrier pigeons were used. The peoples had various methods of notifying about an impending danger: drumming, smoke from bonfires, flags, etc. However, the use of such a presentation of information requires a preliminary agreement on the understanding of the message received.

The famous German scientist Gottfried Wilhelm Leibniz proposed a unique and simple system for representing numbers back in the 17th century. "Calculation using twos ... is fundamental for science and gives rise to new discoveries ... when reducing numbers to the simplest principles, which are 0 and 1, a wonderful order appears everywhere."

Today, this method of presenting information using a language containing only two characters of the alphabet - 0 and 1, is widely used in technical devices, including computers. These two characters 0 and 1 are usually called binary digits or bits (from the English bit - Binary Digit - binary sign).

Engineers were attracted by this coding method by the simplicity of technical implementation - whether there is a signal or not. Any message can be encoded with these two numbers.

The larger unit for measuring the amount of information is considered to be 1 byte, which consists of 8 bits.

It is also accepted to use larger units for measuring the amount of information. The number 1024 (210) is a multiplier when moving to a higher unit of measurement.

Kilobits Kbits

Kbps \u003d 1024 bits ≈1000 bits

Megabits Mbps

1 Mbps \u003d 1024 kbps ≈ 1,000,000 bits

Gigabit Gbps

Gb \u003d 1024 Mbps ≈ 1,000,000,000 bits

Kilobyte KB (KB)

1 KB \u003d 1024 bytes ≈ 1000 bytes

Megabyte MB (MB)

1 MB \u003d 1024 KB ≈ 1,000,000 bytes

Gigabyte GB (GB)

1 GB \u003d 1024 MB ≈ 1,000,000,000 bytes

Terabyte TB (TB)

1 TB \u003d 1024 GB ≈ 1,000,000,000,000 bytes

Petabyte PBbyte (PB)

1PB \u003d 1024TB ≈ 1,000,000,000,000,000 bytes

Exabyte Ebyte (Eb)

1 EB \u003d 1024 PB ≈ 1,000,000,000,000,000,000 bytes

Zettabyte ZByte (Zb)

1 ZB \u003d 1024 Ebytes ≈ 1,000,000,000,000,000,000,000 bytes

Encoding information in a computer

All information that the computer processes must be represented in binary code using two digits - 0 and 1. These two characters are usually called binary digits, or bits. Any message can be encoded with two digits 1 and 0. This was the reason that two important processes must be organized in the computer:

    coding, which is provided by input devices when converting input information into a form perceivable by a computer, that is, into a binary code;

    decoding, which is provided by output devices when converting data from a binary code into a form that is understandable to a person.

From the point of view of technical implementation, the use of the binary number system for encoding information turned out to be much

easier than using other methods. Indeed, it is convenient to encode information in the form of a sequence of zeros and ones, if these values \u200b\u200bare presented as two possible stable states of an electronic element:

    0 - no electrical signal or the signal is low;

    1 - the presence of a signal or the signal is high.

These conditions are easy to distinguish. The disadvantage of binary encoding is long codes. But in technology it is easier to deal with a large number of simple elements than a small number of complex ones.

You and in everyday life have to deal with a device that can only be in two stable states: on / off. Of course, this is a well-known switch. But it turned out to be impossible to come up with a switch that could stably and quickly switch to any of 10 states. As a result, after a series of unsuccessful attempts, the developers came to the conclusion that it was impossible to build a computer based on the decimal number system. And the binary number system was the basis for the representation of numbers in a computer.

Currently, there are different ways of binary encoding and decoding information in a computer. First of all, it depends on the type of information, namely, what should be encoded: text, numbers, graphics or sound. In addition, when encoding numbers, an important role is played by how they will be used: in text, in calculations, or in the I / O process. Features of technical implementation are also superimposed.

Number encoding

Number system - a set of techniques and rules for writing numbers using a specific set of characters.

To write numbers, not only numbers can be used, but also letters (for example, writing Roman numerals - XXI). The same number can be represented differently in different number systems.

Depending on the way numbers are displayed, the number systems are divided into positional and non-positional.

In the positional numeral system, the quantitative value of each digit of a number depends on where (position or digit) one or another digit of this number is written. For example, changing the position of the digit 2 in the decimal number system, you can write decimal numbers of different sizes, for example 2; 20; 2000; 0.02, etc.

In a non-positional numeral system, the numbers do not change their quantitative value when their location (position) in the number changes. An example of a non-positional system is the Roman system, in which, regardless of location, the same symbol has the same meaning (for example, the symbol X in XXV).

The number of different symbols used to represent a number in the positional number system is called the base number system.

In the computer, the most suitable and reliable was the binary number system, in which the sequences of numbers 0 and 1 are used to represent numbers.

In addition, to work with computer memory, it turned out to be convenient to use the representation of information using two more number systems:

    octal (any number is represented using eight digits - 0, 1, 2 ... 7);

    hexadecimal (used characters-numbers - 0, 1, 2 ... 9 and letters - A, B, C, D, E, F, replacing numbers 10, 11, 12, 13, 14, 15, respectively).

Encoding character information

Pressing an alphanumeric key on the keyboard sends a signal to the computer as a binary number representing one of the values \u200b\u200bin the code table. A code table is the internal representation of characters in a computer. All over the world, the ASCII table (American Standard Code for Informational Interchange) is accepted as a standard.

To store the binary code of one character, 1 byte \u003d 8 bits is allocated. Given that each bit is either 1 or 0, the number of possible combinations of ones and zeros is 28 \u003d 256.

This means that using 1 byte, you can get 256 different binary code combinations and display 256 different characters with them. These codes make up the ASCII table.

For example, when you press the key with the letter S, the code 01010011 is written into the computer's memory. When the letter 8 is displayed on the screen, the computer performs decoding - based on this binary code, an image of the symbol is built.

SUN (SUN) - 01010011 010101101 01001110

The ASCII standard encodes the first 128 characters from 0 to 127: numbers, letters of the Latin alphabet, control characters. The first 32 characters are control characters and are intended mainly for transmitting control commands. Their purpose may vary depending on the software and hardware. The second half of the code table (from 128 to 255) is not defined by the American standard and is intended for symbols of national alphabets, pseudographic and some mathematical symbols. Different countries may use different versions of the second half of the code table.

Note! Numbers are encoded according to the ASCII standard and are recorded in two cases - during input-output and when they are encountered in the text. If the numbers are involved in the calculations, then they are converted to another binary code.

For comparison, consider the number 45 for two coding options.

When used in text, this number will require 2 bytes for its representation, since each digit will be represented by its own code in accordance with the ASCII table. In the binary system - 00110100 00110101.

When used in calculations, the code of this number will be obtained according to special translation rules and represented as an 8-bit binary number 00101101, which will require 1 byte.

Graphic information encoding

You can create and store graphic objects in a computer in different ways - as a raster or as a vector image. Each type of image uses its own coding method.

A bitmap is a collection of dots used to display it on a monitor screen. The bitmap volume is defined as the product of the number of dots and the information volume of one dot, which depends on the number of possible colors. For a black-and-white image, the information volume of one point is 1 bit, since a point can be either black or white, which can be encoded with two digits - 0 or 1.

It takes 3 bits to encode 8 colors; for 16 colors - 4 bits; for 6 colors - 8 bits (1 byte), etc.

    black and white coding

    color coding

A vector image is a collection of graphic primitives. Each primitive consists of elementary curve segments, the parameters of which (coordinates of nodal points, radius of curvature, etc.) are described by mathematical formulas. For each line, its type (solid, dotted, dash-dotted), thickness and color are indicated, and closed shapes are additionally characterized by the fill type. Vector images are encoded in different ways depending on the application environment. In particular, the formulas describing the curve segments can be encoded as ordinary alphanumeric information for further processing by special programs.

Audio coding

Sound is a sound wave with continuously varying amplitude and frequency. The larger the signal amplitude, the louder it is for a person, the higher the signal frequency, the higher the tone. In order for the computer to process sound, a continuous sound signal must be converted into a sequence of electrical impulses (binary zeros and ones).

In the process of encoding a continuous audio signal, its time sampling is performed. A continuous sound wave is split into separate small sections, and a specific amplitude value is set for each such section. Thus, the continuous dependence of the signal amplitude on time is replaced by a discrete sequence of loudness levels.

Modern sound cards provide 16-bit audio coding depth. In this case, the number of signal levels will be 65536.

When a continuous audio signal is binary encoded, it is replaced by a sequence of discrete signal levels. The coding quality depends on the number of measurements of the signal level per unit of time, i.e. from the sampling rate. The more measurements are taken in 1 second (the higher the sampling rate), the more accurate the binary coding procedure.

The number of measurements per second can range from 8000 to 48000, i.e. the sampling frequency of the analog audio signal can range from 8 to 48 kHz - the sound quality of audio CDs. It should also be borne in mind that both mono and stereo modes are possible.

Sound Recorder The standard Windows program Sound Recorder acts as a digital recorder and allows you to record sound; sample audio signals, and save them in audio files in wav format. Also, this program allows you to make the simplest editing of sound files.