Number systems are the whole theory. Arithmetic operations in various binary number systems. Arithmetic operations in various number systems

To work with data, use coding, i.e. expression of data of one type through data of another type.

The system also exists in computing- it is called binary coding and is based on the representation of data by a sequence of only two characters: 0 and 1. These characters are called binary digits, in English - binarydigit or, in short, bit (bit).

Two concepts can be expressed with one bit: 0 or 1 (Yes or no, black or white, true or Lying etc.). If the number of bits is increased to two, then four different concepts can already be expressed:

Eight different values ​​can be encoded with three bits: 000 001 010 011 100 101 110 111

By increasing the number of bits in the binary coding system by one, we double the number of values ​​that can be expressed in this system, that is, the general formula is:

N = 2 m, where:

N - number of independent encoded values;

T- bit coding width, adopted in this system.

Since a bit is too small a unit of measurement, in practice a larger unit is often used - a byte, equal to eight bits.

Larger derived data units are also used:

Kilobyte (KB) = 1024 bytes = 2 10 bytes;

Megabyte (MB) = 1024 KB = 2 20 bytes;

Gigabyte (GB) = 1024 MB = 2 30 bytes.

V recent times in connection with the increase in the volume of processed data, such derived units as:

Terabyte (TB) = 1024 GB = 2 40 bytes;

Petabytes (PB) = 1024 TB = 2 50 bytes;

Exabyte (Ebyte) = 1024 PB = 2 60 bytes.

Coding text information produced by American standard code for the exchange of ASCII information, in which character codes are set from 0 to 127. National standards allocate 1 byte of information for a character and include a table of ASCII codes, as well as codes of national alphabets with numbers from 128 to 255. Currently, there are five different encodings of the Cyrillic alphabet: KOI-8, MS-DOS, Windows, Macintosh and ISO. In the late 90s, a new international standard Unicode, which allocates not one byte, but two bytes for each character, and therefore, with its help, you can encode not, but different characters.



Basic encoding table ASCII is given in the table.

Color coding graphic images produced using a raster, where each point is associated with its color number. In the RGB coding system, the color of each point is represented by the sum of red (Red), green (Green) and blue (Blue). In the CMYK coding system, the color of each dot is represented by the sum of Cyan, Magenta, Yellow, and the addition of Black (K).

Analog Signal Coding

Historically, the first technological form of receiving, transmitting and storing data was analog (continuous) representation of a sound, optical, electrical or other signal. To receive such signals in a computer, an analog-to-digital conversion is first performed.

Analog-to-digital conversion consists in measuring an analog signal at regular intervals τ and coding the measurement result with an n-bit binary word. In this case, a sequence of n-bit binary words is obtained, representing an analog signal with a given accuracy.

The currently accepted CD standard uses what is called “16-bit audio with a 44 kHz scan rate”. For the given figure, translated into normal language, this means that the "step length" (t) is equal to 1/44000 s, and the "step height" (δ) is 1/65 536 of the maximum signal loudness (since 2 16 = 65 536) ... Wherein frequency range playback is 0-22 kHz, and dynamic range- 96 decibels (which is a completely unattainable quality characteristic for magnetic or mechanical sound recording).

Compression of data.

The volume of processed and transmitted data is growing rapidly. This is due to the implementation of more and more complex application processes, the emergence of new information services, the use of images and sound.

Data compression (datacompression)- a process for reducing the amount of data. Compression can drastically reduce the amount of memory required for storing data, and reduce (to an acceptable size) the time of data transfer. Image compression is especially effective. Data compression can be carried out both by software and hardware or a combined method.

Compression of texts is associated with a more compact layout bytes, encoding characters. It also uses a space repetition counter. As for sound and images, the amount of information that represents them depends on the selected quantization step and the number of analog-to-digital conversion bits. Basically, it uses the same compression methods as for word processing. If the compression of texts occurs without loss of information, then the compression of sound and images almost always leads to some loss of information. Compression is widely used in data archiving.

Notation- representation of a number by a specific set of characters. Number systems are:

1. Single (system of tags or sticks);

2. Non-positional (Roman);

3. Positional (decimal, binary, octal, hexadecimal, etc.).

Positional is a number system in which the quantitative value of each digit depends on its place (position) in the number. The basis positional number system is an integer raised to a power, which is equal to the number of digits in this system.

The binary number system includes an alphabet of two numbers: 0 and 1.

The octal number system includes an alphabet of 8 digits: 0, 1, 2, 3, 4, 5, 6, and 7.

The decimal number system includes an alphabet of 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.

The hexadecimal number system includes a 16-digit alphabet: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.

A B C D E F

In computing, coding is used in the binary number system, i.e. sequence 0 and 1.

To convert an integer from one number system to another, you need to perform the following algorithm:

1. The base of the new number system is expressed by the numbers of the original number system.

2. Consecutively perform division of the given number by the base of the new number system until the quotient is less than the divisor.

3. The resulting balances should be transferred to the new number system.

4. Make a number from the remainders in new system reckoning starting from the last remainder.

In the general case, in a positional SS with a base P, any number X can be represented as a polynomial from the base P:

X = a n P n + a n-1 P n-1 + ... + a 1 P 1 + a o P 0 + a -1 P -1 + a -2 P -2 + ... + a -m P -m,

where as the coefficients a i can be any of the P digits used in the CC with the base P.

Conversion of numbers from 10 SS to any other for the integer and fractional parts of the number is performed different methods:

a) the integer part of the number and intermediate quotients are divided by the base of the new SS, expressed in 10 SS until the quotient of the division becomes less than the base of the new SS. Actions are performed in 10 SS. The result is quotients written in reverse order.

b) the fractional part of the number and the resulting fractional parts of the intermediate products are multiplied by the base of the new SS until the specified accuracy is reached, or "0" is obtained in the fractional part of the intermediate product. The result is whole parts of intermediate pieces, written in the order in which they were received.

Using formula (1), you can convert numbers from any number system to the decimal number system.

Example 1. Convert the number 1011101.001 from binary number system (SS) to decimal SS. Solution:

1 2 6 + 0 2 5 + 1 2 4 + 1 · 2 3 + 1 · 2 2 + 0 · 2 1 + 1 2 0 + 0 2 -1 + 0 2 -2 + 1 2 -3 = 64 + 16 + 8 + 4 + 1 + 1/8 = 93.125

Example 2. Convert 1011101.001 from octal number system (SS) to decimal SS. Solution:

Example 3... Convert the number AB572.CDF from hexadecimal base to decimal SS. Solution:

Here A-replaced by 10, B- at 11, C- at 12, F- by 15.

Converting an 8 (16) number into 2 form - it is enough to replace each digit of this number with the corresponding 3-bit (4-bit) binary number. Discard unnecessary zeros in the most significant and least significant digits.

Example 1: Convert the number 305.4 8 to binary SS.

(_3_ _0 _ _5 _ , _4 _) 8 = 011000101,100 = 11000101,1 2

Example 2: convert the number 9AF, 7 16 to binary CC.

(_9 __ _A __ _F __ , _7 __) 16 = 100110101111,0111 2

1001 1010 1111 0111

To translate the 2nd number into 8 (16) SS, proceed as follows: moving from the comma to the left and to the right, divide the binary number into groups of 3 (4) digits, supplementing the extreme left and right groups with zeros if necessary. Then each group is replaced with the corresponding octal (16) digit.

Example 1: Convert the number 110100011110100111,1001101 2 to octal SS.

110 100 011 110 100 111,100 110 100 2 = 643647,464 8

Example 2: Convert the number 110100011110100111,1001101 2 to hexadecimal SS.

0011 0100 0111 1010 0111.1001 1010 2 = 347A7.9A 16

Arithmetic operations in all positional number systems, the numbers are executed according to the same rules well known to you.

Addition. Consider the addition of numbers in the binary number system. It is based on the addition table of one-bit binary numbers:

0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10

It is important to pay attention to the fact that when two units are added, a discharge overflow occurs and a transfer is made to the most significant bit. The overflow of the digit occurs when the value of the number in it becomes equal to or greater than the base.

The addition of multi-digit binary numbers occurs in accordance with the above addition table, taking into account possible transfers from the least significant bits to the most significant ones. As an example, add the binary numbers 110 2 and 11 2 into a column:

Subtraction. Consider the subtraction of binary numbers. It is based on a subtraction table for one-bit binary numbers. When subtracting from a smaller number (0) a larger one (1), a loan is made from the most significant bit. In the table, the loan is designated 1 with a line:

Multiplication. The multiplication is based on the multiplication table of one-bit binary numbers:

Division. The division operation is performed according to an algorithm similar to the algorithm for performing the division operation in the decimal number system. As an example, let's divide the binary number 110 2 by 11 2:

To carry out arithmetic operations on numbers expressed in different number systems, you must first translate them into the same system.

Notation(SS) is a set of techniques and rules for writing numbers using a specific set of characters.
Alphabet SS - a set of symbols (numbers) used to write a number.
Base SS (power of the SS alphabet) - the number of characters (numbers) of the SS alphabet.
All number systems are divided into positional and non-positional. Non-positional number system is a system in which the quantitative equivalent of each digit does not depend from its position (place, position) in the number record.
So, in non-positional number systems, the position that the digit occupies in the number recording does not matter. So, for example, the Roman numeral system is non-positional. In numbers XI and IX, the "weight" of both digits is the same, regardless of their location.

Positional number systems

A positional number system is a system in which the value of a digit depends from its place (position) in the number record. The base of the number system is the number of characters or symbols used to represent a number in a given number system
The base of the number system determines its name: the base p is the p-th number system.
For example, the number system mainly used in modern mathematics is the positional decimal system, its base is ten. To write any numbers, it uses ten well-known digits (0,1,2,3,4,5,6,7,8,9).

So, we said that in positional notation systems, the position that the digit occupies in the number record matters. So, writing 23 means that this number can be composed of 3 units and 2 tens. If we change the positions of the numbers, we get a completely different number - 32. This number contains 3 tens and 2 units. The "weight" of the two has decreased tenfold, and the "weight" of the three has increased tenfold. Expanded number notation
Any number N in the positional numeral system with a radix p can be represented as a polynomial in p:
N = akpk + a k-1 p k-1 + a k-2 p k-2 + ... + a 1 p 1 + a 0 p 0 + a -1 p -1 + a -2 p -2 + ...,
where N is a number, p is the base of the number system (p> 1), and i are the digits of the number (coefficients at the power of p).
Numbers in the p-th number system are written as a sequence of numbers:
N = a k a k-1 a k-2 ... a 1 a 0, a -1 a -2 ...
A comma in the sequence separates the integer part of the number from the fractional part.
3210 -1-2
N = 4567,12 10 =4 *10 3 +5 *10 2 +6 *10 1 +7 *10 0 +1 *10 -1 +2 *10 -2

Binary number system

To write numbers, only two digits are used - 0 and 1. The choice of a binary system for use in a computer is explained by the fact that the electronic elements from which computers are built can be in only two clearly distinguishable states. Essentially, these elements are switches. As you know, the switch is either on or off. There is no third. One of the states is designated by the number 1, the other - 0. Thanks to these features, the binary system has become the standard in the construction of computers.
In this number system, any number can be represented as:
N = ak 2 k + a k-1 2 k-1 + a k-2 2 k-2 + ... + a 1 2 1 + a 0 2 0 + a -1 2 -1 + a -2 2 - 2 + ....
For example: 11001.01 2 = 1 * 2 4 +1 * 2 3 +0 * 2 2 +0 * 2 1 +1 * 2 0 +0 * 2 -1 +1 * 2 -2 (expanded representation of the number in the binary number system)

Binary arithmetic

Arithmetic operations in all positional number systems are performed according to the same well-known rules.

Addition

Consider the addition of numbers in the binary number system. It is based on the addition table of one-bit binary numbers:

0+0=0
0+1=1
1+0=1
1+1=10
1+1+1=11

It is important to pay attention to the fact that when two units are added, a discharge overflow occurs and a transfer is made to the most significant bit. The overflow of a digit occurs when the value of the number in it becomes equal to or greater than the base of the number system. For the binary number system, this value is equal to two.
The addition of multi-digit binary numbers is performed in accordance with the above addition table, taking into account possible transfers from the least significant bits to the higher ones.

Subtraction

Consider the subtraction of binary numbers. It is based on a subtraction table for one-bit binary numbers. When subtracting from a smaller number (0) a larger one (1), a loan is made from the most significant bit. In the table, the loan is designated 1 with a line.

0-0=_0
0-1=11
1-0=1
1-1=0

Addition and Subtraction of One-Bit Binary Numbers
Addition and subtraction of multi-digit binary numbers (examples)

Multiplication

The multiplication is based on the multiplication table of one-bit binary numbers:

0*0=0
0*1=0
1*0=0
1*1=1

Multiplication of multi-digit binary numbers occurs in accordance with the given multiplication table according to the usual scheme used in the decimal number system, with the sequential multiplication of the multiplier by the next digit of the multiplier.

Division

The division operation is performed according to an algorithm similar to the algorithm for performing the division operation in decimal notation.

| Informatics and information and communication technologies | Lesson planning and lesson materials | 10 classes | Planning lessons for the academic year (FSES) | Arithmetic operations in positional number systems

Lesson 15
§12. Arithmetic operations in positional number systems

Arithmetic operations in positional number systems

Arithmetic operations in positional radix systems q are performed according to the rules similar to those in the decimal number system.

V primary school to teach children to count, use tables of addition and multiplication. Similar tables can be compiled for any positional number system.

12.1. Addition of numbers in base q

Consider examples of addition tables in ternary (Table 3.2), octal (Table 3.4) and hexadecimal (Table 3.3) number systems.

Table 3.2

Addition to ternary system reckoning

Table 3.3

Hexadecimal addition

Table 3.4

Octal addition

q get the amount S two numbers A and B, it is necessary to sum up the digits forming them by the digits i from right to left:

If a i + b i< q, то s i = a i + b i , старший (i + 1)-й разряд не изменяется;
if a i + b i ≥ q, then s i = a i + b i - q, the most significant (i + 1) th bit is increased by 1.

Examples:

12.2. Subtraction of numbers in base q

So that in radix q get the difference R two numbers A and V, it is necessary to calculate the differences of the digits forming them by the digits i from right to left:

If a i ≥ b i, then r i = a i - b i, the most significant (i + 1) th bit does not change;
if a i< b i , то r i = a i - b i + g, старший (i + 1)-й разряд уменьшается на 1 (выполняется заём в старшем разряде).

LESSON №19-20.

Theme

Arithmetic operations in positional number systems. Multiplication and division.

The purpose of the lesson: show ways of arithmetic operations (multiplication and division) of numbers in different systems reckoning, check the assimilation of the topic "Addition and subtraction of numbers in different number systems."

Lesson Objectives:

    educational: practical use the studied material on the topic "Multiplication and division in different number systems", consolidation and testing of knowledge on the topic "Addition and subtraction of numbers in different number systems". developing: development of skills for individual practical work, the ability to apply knowledge to solve problems. educational: achievement of conscious assimilation of the material by students.

Materials and equipment for the lesson: cards for independent work, multiplication tables.

Lesson type: combined lesson

Lesson form: individual, frontal.

During the classes:

1. Checking homework.

Homework:

1. № 2.41 (1 and 2 columns), workshop, p. 55

Solution:

A) 11102 + 10012 = 101112

B) 678 + 238 = 1128

B) AF16 + 9716 = 14616

D) 11102-10012 = 1012

D) 678-238 = 448

E) AF16-9716 = 1816

2. No.2.48 (p. 56)

2. Independent work"Addition and subtraction of numbers in different number systems." (20 minutes)

Independent work. Grade 10 .

11 + 1110 ; 10111+111 ; 110111+101110

3. Subtract: 10111-111; 11 - 1110

4. Add and subtract in the 8-ary system: 738 and 258

Option 1

Independent work. Grade 10. Binary number system: translation 2® 10; addition.

1. Perform the conversion from binary to decimal.

2. Add two binary numbers.

1110+111 ; 111+1001 ; 1101+110001

3. Subtract: 111-1001; 1110 + 111

4. Add and subtract in hex: 7316 and 2916

Option 2

3. New material.

1. Skill

When multiplying multi-digit numbers in various positional number systems, you can use the usual algorithm for multiplying numbers in a column, but the results of multiplication and addition of single-digit numbers must be borrowed from the multiplication and addition tables corresponding to the system under consideration.

Binary multiplication

Octal multiplication

Due to the extreme simplicity of the multiplication table in the binary system, multiplication is reduced only to shifts of the multiplicand and additions.

Example 1. Let's multiply the numbers 5 and 6 in decimal, binary, octal and hexadecimal notation systems.

https://pandia.ru/text/80/244/images/image004_82.gif "width =" 419 "height =" 86 src = ">
Answer: 5 . 6 = 3010 = 111102 = 368.
Examination.
111102 = 24 + 23 + 22 + 21 = 30;
368 = 381 + 680 = 30.

Example 2. Let's multiply the numbers 115 and 51 in decimal, binary, octal and hexadecimal notation systems.

https://pandia.ru/text/80/244/images/image006_67.gif "width =" 446 "height =" 103 src = ">
Answer: 115 . 51 = 586510 = 10110111010012 = 133518.
Examination. We transform the resulting products to decimal form:
10110111010012 = 212 + 210 + 29 + 27 + 26 + 25 + 23 + 20 = 5865;
133518 = 1 . 84 + 3 . 83 + 3 . 82 + 5 . 81 + 1 . 80 = 5865.

2. D in e

Division in any positional number system is performed according to the same rules as division by an angle in the decimal system. In binary, division is particularly easy, because the next digit of the quotient can be only zero or one.
Example 3. Divide the number 30 by the number 6.

https://pandia.ru/text/80/244/images/image008_48.gif "width =" 478 "height =" 87 src = ">
Answer: 30: 6 = 510 = 1012 = 58.

Example 4. Divide 5865 by 115.

https://pandia.ru/text/80/244/images/image010_50.gif "width =" 400 "height =" 159 src = ">

Octal: 133518:1638

https://pandia.ru/text/80/244/images/image012_40.gif "width =" 416 "height =" 18 src = ">

https://pandia.ru/text/80/244/images/image014_36.gif "width =" 72 "height =" 89 src = ">
Answer: 35: 14 = 2,510 = 10,12 = 2,48.
Examination. Convert the resulting quotients to decimal:
10,12 = 21 + 2 -1 = 2,5;
2,48 = 2 . 80 + 4 . 8-1 = 2,5.

4. Homework:

1. Prepare for the test number 2 "On the subject of number systems. Translation of numbers. Arithmetic operations in number systems "

2. Workshop Ugrinovich, No. 2.46, 2.47, p. 56.

Literature:

1. Workshop on Informatics and Information Technology. Tutorial for educational institutions /,. - M .: Binom. Laboratory of Knowledge, 2002.400 p .: ill.

2. Ugrinovich and information Technology... Textbook for grades 10-11. - M.: BINOM. Knowledge Laboratory, 2003.

3. Shautsukova: Educational. allowance for 10-11 grades general education. institutions. - M .: Education, 2003.9 - p. 97-101, 104-107.

Number systems.

Number system call a set of symbols (numbers) and the rules for their use to represent numbers.

There are positional and non-positional number systems.

Vnon-positional systems weight numbers(i.e. the contribution that she makes to the value of the number) does not depend on her position in the notation of the number. So, in the Roman numeral system, in the number XXXII (thirty-two), the weight of the figure X in any position is just ten.

Vpositional systems reckoning the weight of each digit changes depending on its position(positions) in a sequence of digits representing a number. For example, in the number 757.7, the first seven means 7 hundred, the second - 7 units, and the third - 7 tenths of one.

The very same notation of the number 757.7 means an abbreviated notation of the expression

700 + 50 + 7 + 0,7 = 7 10 2 + 5 10 1 + 7 10 0 + 7 10 -1 = 757,7.

Any positional number system is characterized by its basis.

Base of positional number system is the number of different characters or symbols used to represent numbers in a given system.

Countless positioning systems possible: binary, ternary, quaternary, etc. Writing numbers in each of the radix systems q means shorthand expression

a n-1 q n-1 + a n-2 q n-2 + ... + a 1 q 1 + a 0 q 0 + a -1 q -1 + ... + a - m q - m , where a i - numeral numbers; n and m - the number of integer and fractional digits, respectively.

For example:

In addition to decimal, systems with a radix are widely used. whole power of 2, namely:

    binary(numbers 0, 1 are used);

    octal(numbers 0, 1, ..., 7 are used);

    hexadecimal(for the first integers from zero to nine, the digits 0, 1, ..., 9 are used, and for the next integers, from ten to fifteen, the characters A, B, C, D, E, F are used as digits).

It is useful to remember the entry in these number systems for the first two tens of integers:

Of all number systems especially simple and therefore interesting for technical implementation in computers binary number system.

Translation octal and hexadecimal numbers to binary very simple: it is enough to replace each digit with its equivalent binary triad (three digits) or notebook (four digits).

For example:


To translate a number from binary systems in octal or hexadecimal, it must be split to the left and right of the comma by triads(for octal) or tetrads(for hexadecimal) and replace each such group with the corresponding octal (hexadecimal) digit.

For example,

When translating the whole decimal numbers in the base system q it must be consistently divide on q until there is a remainder less than or equal to q – 1... Base number q is written as a sequence of modulo, written in reverse order, starting with the last one.

Example: Convert Decimal to Binary, Octal and Hexadecimal:

Answer: 75 10 = 1 001 011 2 = 113 8 = 4B 16.

When translating a number from binary (octal, hexadecimal) system in decimal this number must be represented as the sum of the degrees of the base of its number system.

examples: