Tasks for determining values ​​in various number systems and their bases

Exercise 1. To encode characters @, $, &,%, two-digit sequential binary numbers are used. The first character corresponds to the number 00.Using these characters, the following sequence was encoded: $% [email protected]$. Decode the given sequence and convert the result to hexadecimal notation.

Solution.

1. Let us compare the binary numbers to the characters they coded:
00 — @, 01 — $, 10 — &, 11 — %

3. Let's translate a binary number into a hexadecimal number system:
0111 1010 0001 = 7A1

Answer. 7A1 16.

Task 2. In the garden there are 100 x fruit trees, of which 33 x are apple trees, 22 x ...
- pears, 16 x - plums, 17 x - cherries. What is the base of the number system (x).

Solution.

1. Note that all terms are two-digit numbers. In any number system, they can be represented as follows:
a * x 1 + b * x 0 = ax + b, where a and b are the digits of the corresponding digits of the number.
For a three-digit number, it will be like this:
a * x 2 + b * x 1 + c * x 0 = ax 2 + bx + c

2. The condition of the problem is as follows:
33 x + 22 x + 16 x + 17 x = 100 x
Let's substitute the numbers in the formulas:
3x + 3 + 2x +2 + 1x + 6 + 1x + 7 = 1x 2 + 0x + 0
7x + 18 = x 2

3. Let's solve the quadratic equation:
-x2 + 7x + 18 = 0
D = 7 2 - 4 * (-1) * 18 = 49 + 72 = 121.The square root of D is 11.
Quadratic Roots:
x = (-7 + 11) / (2 * (-1)) = -2 or x = (-7 - 11) / (2 * (-1)) = 9

4. A negative number cannot be the base of the number system. Therefore, x can only be equal to 9.

Answer. The sought radix is ​​9.

Task 3. In the base system, decimal number 12 is written as 110. Find this base.

Solution.

First, we write the number 110 through the formula for writing numbers in positional number systems to find the value in the decimal number system, and then find the base by brute force.

110 = 1 * x 2 + 1 * x 1 + 0 * x 0 = x 2 + x

We need to get 12. Try 2: 2 2 + 2 = 6. Try 3: 3 2 + 3 = 12.

So the base of the number system is 3.

Answer. The sought radix is ​​3.

Hexadecimal and octal number systems

Exercise 1. What is the hexadecimal number for 11000101?

Solution.

When converting a binary number to hexadecimal, the first is divided into groups of four digits, starting from the end. If the number of digits is not divisible by four, then the first four is appended with leading zeros. Each four is uniquely represented by one hexadecimal number.

11000101 = 1100 0101 = C5 16

There is no need to have a correspondence table in front of your eyes. Binary counting of the first 15 numbers can be carried out in the mind or sequentially painted. It should not be forgotten that 10 in decimal corresponds to A in hexadecimal, 11 to B, 12 to C, 13 to D, 14 to E, 15 to F.

Answer. 11000101 = C5 16

Task 2. Calculate the sum of the binary numbers x and y, with x = 10100 and y = 10101. Present the results as an octal number.

Solution.

Let's add two numbers. The rules for binary and decimal arithmetic are the same:

When converting a binary number to octal, the first is divided into groups of three digits, starting from the end. If the number of digits is not divisible by three, then the first three is appended with zeros in front:

Answer. The octal sum of the binary numbers 10100 and 10101 is 51.

Binary translation

Exercise 1. What is 37 in binary notation?

Solution.

You can perform the conversion by dividing by 2 and combining the remainders in reverse order.

Another way is to expand the number into the sum of the powers of two, starting with the highest one, the calculated result of which is less than the given number. When converting, the missing powers of a number should be replaced with zeros:

37 10 = 32 + 4 + 1 = 2 5 + 2 2 + 2 0 = 1 * 2 5 + 0 * 2 4 + 0 * 2 3 + 1 * 2 2 + 0 * 2 1 + 1 * 2 0 = 100101

Answer. 37 10 = 100101 2 .

Task 2. How many significant zeros are there in binary notation for decimal 73?

Solution.

Let us expand the number 73 into the sum of powers of two, starting with the highest and multiplying the omitted powers by zeros, and the existing ones by one:

73 10 = 64 + 8 + 1 = 2 6 + 2 3 + 2 0 = 1 * 2 6 + 0 * 2 5 + 0 * 2 4 + 1 * 2 3 + 0 * 2 2 + 0 * 2 1 + 1 * 2 0 = 1001001

Answer. There are four significant zeros in binary notation for decimal 73.

Task 3. Calculate the sum of the numbers x and y at x = D2 16, y = 37 8. Present the result in binary notation.

Solution.

Recall that each digit of a hexadecimal number is formed by four binary digits, each digit of an octal number is formed by three:

D2 16 = 1101 0010
37 8 = 011 111

Let's add the resulting numbers:

Answer. The sum of the numbers D2 16 and y = 37 8, represented in binary notation, is 11110001.

Task 4. Given: a= D7 16, b= 331 8. Which of the numbers c, written in the binary number system, meets the condition a< c < b ?

  1. 11011001
  2. 11011100
  3. 11010111
  4. 11011000

Solution.

Let's translate the numbers into the binary number system:

D7 16 = 11010111
331 8 = 11011001

The first four digits of all numbers are the same (1101). Therefore, the comparison is simplified to the comparison of the least significant four bits.

The first number on the list is equal to the number b therefore does not fit.

The second number is more like b... The third number is a.

Only the fourth number is suitable: 0111< 1000 < 1001.

Answer. The fourth option (11011000) meets the condition a< c < b .

Decimal notation conversion

Exercise 1. What number in decimal notation corresponds to the number 24 16?

Solution.

24 16 = 2 * 16 1 + 4 * 16 0 = 32 + 4 = 36

Answer. 24 16 = 36 10

Task 2. It is known that X = 12 4 + 4 5 + 101 2. What is X in decimal notation?

Solution.


12 4 = 1 * 4 1 + 2 * 4 0 = 4 + 2 = 6
4 5 = 4 * 5 0 = 4
101 2 = 1 * 2 2 + 0 * 2 1 + 1 * 2 0 = 4 + 0 + 1 = 5
Find the number: X = 6 + 4 + 5 = 15

Answer. X = 15 10

Task 3. Calculate the value of the sum 10 2 + 45 8 + 10 16 in decimal notation.

Solution.

Let's translate each term in the decimal number system:
10 2 = 1 * 2 1 + 0 * 2 0 = 2
45 8 = 4 * 8 1 + 5 * 8 0 = 37
10 16 = 1 * 16 1 + 0 * 16 0 = 16
The sum is equal to: 2 + 37 + 16 = 55

Answer. 55 10

Arithmetic operations in the binary number system

Number systems

Topic number:

In the binary number system, arithmetic operations are performed according to the same rules as in the decimal number system, since they are both positional (along with octal, hexadecimal, etc.).

Addition

One-bit binary numbers are added according to the following rules:

In the latter case, when two units are added, an overflow of the least significant bit occurs, and the unit is transferred to the most significant bit. Overflow occurs when the sum is equal to the base of the number system (in this case, it is the number 2) or more (for the binary number system, this is not relevant).

For example, let's add any two binary numbers:

Subtraction

Subtraction of one-bit binary numbers is performed according to the following rules:

0 - 1 = (high-order loan) 1

Multiplication

Multiplication of one-bit binary numbers is performed according to the following rules:

Division

Division is performed in the same way as in the decimal number system:

Converting a Binary to Decimal Number

The conversion of a number from a binary system to a decimal system can be carried out for the integer and fractional parts of the number according to one algorithm by calculating the sum of the products of the digit of a binary number by the weight of its familiarity:

11100011 2 =1*2 7 +1*2 6 +1*2 5 +0*2 4 +0*2 3 +0*2 2 +1*2 1 +1*2 0 =128+64+32+2+1=227 10

0,10100011 2 =1*2 -1 +0*2 -2 +1*2 -3 +0*2 -4 +0*2 -5 ++0*2 -6 +1*2 -7 +1*2 -8 =0.5+0.125+0.0078+0.0039=0.6367

Converting Decimal to Binary

The conversion of a number from the decimal system to the binary is carried out separately for the integer and fractional parts of the number according to the following algorithms:

a) integer decimal number is divided entirely by the base 2, then all quotients from the integer division are sequentially divided by 2 until the quotient becomes less than the base. The last quotient and all the remainders of the division, starting with the last, are entered into the result. For instance:

convert the number 227 to binary:

227: 2 = 113 (write the remainder of division 1 into the result), 113: 2 = 56 (write the remainder of division 1 into the result), 56: 2 = 28 (write the remainder of division 0 into the result), 28: 2 = 14 (write the remainder of division 0 into the result), 14: 2 = 7 (write the remainder of division 0 into the result), 7: 2 = 3 (write the remainder of division 1 into the result), 3: 2 = 1 (write the remainder from division 1), we write in the result the last quotient - 1. Total we get: 227 10 = 11100011 2. Let's check it back:

1*2 0 +1*2 1 +0*2 2 +0*2 3 +0*2 4 +1*2 5 +1*2 6 +1*2 7 =1+2+32+64+128=227

b) decimal fraction is sequentially multiplied by the base 2, and immediately after each multiplication operation, the resulting integer part is written into the result and does not participate in further multiplication (discarded). The number of multiplication operations depends on the required precision, for example:

let's convert the number 0.64 to binary:

0.64 * 2 = 1.28 (discard 1 and write 1 in the result)

0.28 * 2 = 0.56 (write 0 in the result)

0.56 * 2 = 1.12 (discard 1 and write 1 in the result)

0.12 * 2 = 0.24 (write 0 in the result)

0.24 * 2 = 0.48 (write 0 in the result)

0.48 * 2 = 0.96 (write 0 in the result)

0.96 * 2 = 1.82 (we write in the result 1)

Total: 0.64 10 = 0.1010001 2

Let's check it back:

1*2 -1 +0*2 -2 +1*2 -3 +0*2 -4 +0*2 -5 +0*2 -6 +1*2 -7 = 0.5*0+0.125+0+0+0+0.0078=0.6328

Computer representation of negative numbers

It should be borne in mind that in the computer memory, binary numbers are stored in registers consisting of 8 cells, i.e. the smallest binary number that can be stored in memory must be eight bits. In this case, zeros are written in the unfilled cells of the register (in the high-order bits).

Unlike the decimal system, the binary number system does not have special characters that indicate the sign of a number: positive (+) or negative (-), therefore, the following two forms are used to represent binary negative numbers.

Signed value form- the most significant (left) digit is marked as signed and contains information only about the sign of the number:

1 - negative number, 0 - positive number.

The rest of the digits are reserved for the absolute value of the number.

5 10 = 0000 0101 2 ; -5 10 =1000 0101 2 .

The structure of the computer is designed in such a way that negative numbers are represented in two's complement code, since this gives a significant saving in time when performing arithmetic operations with them.

The form of a reverse additional code, the translation into which is carried out according to the following algorithm:

1) Discard the sign bit;

2) invert all digits of the number;

3) add one to the resulting code;

4) restore the unit in the signed digit.
For instance:

Converting the number -5 10

We write in binary: 1000 0101; we discard the sign bit: 000 0101; inverting all the digits: 111 1010; add one: 111 1010 + 1 = 111 1011; we restore the unit in the sign bit: 1111 1011. Total -5 10 in the reverse's complement code is written as 1111 1011.

Rules for performing arithmetic operations in the binary system

Addition. The addition operation is performed in the same way as in the decimal system. A discharge overflow results in a one in the next discharge:

0+0=0, 0+1=1, 1+1=10;

+ 111011

Subtraction. Since most modern computers have only one hardware adder, with the help of which all arithmetic operations are implemented, subtraction is reduced to addition with a negative number:

Subtraction rules in the binary system. Algorithm for the subtraction operation by adding additional codes:

1) convert a negative signed number to a complementary code;

2) perform a binary addition operation on all digits,
including signed, ignoring the hyphenation unit from the highest
discharge;

3) when the signed digit of the sum is equal to the unit, which means
obtaining a negative result in the form of an additional code,
it is necessary to translate the result into a sign form (using a conversion algorithm).

For example, let's perform action 13-15 = 13 + (- 15)

1. We translate -15 into the form of an additional code:

1000 1111 –> 000 1111 -> 111 0000 -> 111 0000 +1=111 0001 -> 1111 0001

2. Add 13 and -15:

+11110001

3. We translate into the usual binary form:

1111 1110 -> 111 1110 ->000 0001 -> 000 0001+1=000 0010 -> 1000 0010 = -2 10

Thus, when performing addition and subtraction operations, the arithmetic logic unit of the processor has to perform bitwise addition with carry, inversion and sign check of binary numbers.

In those cases when it is necessary to perform arithmetic operations on numbers greater than 127, they are located not in one, but in two or more bytes.

For example, let's perform the action: 15-13 = 15 + (- 13)

1. We translate -13 into the form of an additional code:

1000 1101 –> 000 1101 -> 111 0010 -> 111 0010 +1=111 0011 -> 1111 0011

2. Add 15 and -13:

+11110011

3. The sign bit is 0, no reverse translation is required, that is, the result is 0000 0010 = 2 10

Multiplication. If, along with the listed operations, you perform shift operations, then using the adder, you can also perform multiplication, which is reduced to a series of repeated additions. If the digit in the zero position of the multiplier is 1, then the multiplier is rewritten under the corresponding digits, multiplication by subsequent ones leads to a shift of the term to the left by one position. If the digit of the multiplier is 0, then the next term is shifted two positions to the left.

For example, let's multiply 6 (0000 0110) by 5 (0000 0101):

*00000101

(multiply by 1) +00000110

(multiply by 0) 1

(multiply by 1) + 0000011011

Let's check: 0001 1110 = 0 * 2 0 + 1 * 2 1 + 1 * 2 2 + 1 * 2 3 + 1 * 2 4 = 2 + 4 + 8 = 16 = 30

For example, let's multiply 15 (0000 1111) by 13 (0000 1101):

*00001101

(multiply by 1) +00001111

(multiply by 0) 1

(multiply by 1) +0000111111

(multiply by 1) + 00001111111

Let's check: 1100 0011 = 1 * 2 7 + 1 * 2 6 + 0 * 2 5 + 0 * 2 4 + 0 * 2 3 + 0 * 2 2 + 1 * 2 1 + 1 * 2 0 = 1 + 2 + 64 + 128 = 195

Division. When performing a division operation, a subtraction operation is performed several times. Therefore, you must first find an additional divisor code. Division is performed by repeated subtraction and shift. For example, let's divide the number 195 (1100 0011) by 15 (0000 1111). Additional code of the number 0000 1111 -> 11110001. Since, according to the rules of division, each intermediate dividend must be greater than the divisor, we select the number 11000 as the first dividend, i.e. the first five digits and add three zeros to the left, complementing the dividend to 8 digits. Then we add it with the additional code of the dividend and enter one into the result. If the next dividend after the demolition of the next digit is less than the divisor, then zero is entered into the result and one more digit from the original dividend is demolished into the dividend.

Example 1 Find X, if To transform the left side of the equality, we successively use the de Morgan law for logical addition and the law of double negation: According to the distribution law for logical addition: According to the law of exclusion of the third and the law of elimination of constants: We equate the resulting left side with the right: X = B Finally, we get: X = B. Example 2. Simplify the logical expression Check the correctness of the simplification using the truth tables for the original and the resulting logical expression. According to the general inversion law for logical addition (de Morgan's first law) and the law of double negation: According to the distribution (distributive) law for logical addition: According to the law of contradiction: According to the law of idempotency Substitute the values ​​and, using the displaceable (commutative) law and grouping the terms, we get : According to the law of exclusion (gluing) Substitute the values ​​and get: According to the law of exclusion of constants for logical addition and the law of idempotency: Substitute the values ​​and get: According to the distribution (distributive) law for logical multiplication: According to the third exclusion law: Substitute the values ​​and finally get: 2 Logical foundations of a computer A discrete converter, which, after processing input binary signals, outputs a signal at the output, which is the value of one of the logical operations, is called a logical element. Below are the symbols (diagrams) of the basic logic gates that implement logical multiplication (conjunctor), logical addition (disjunctor) and negation (inverter). Rice. 3.1. Conjunctor, Disjunctor and Inverter Computer devices (adders in the processor, memory cells in RAM, etc.) are built on the basis of basic logic elements. Example 3. For a given logical function F (A, B) = = B & AÚB & A, construct a logic circuit. The construction must begin with a logical operation, which must be performed last. In this case, such an operation is a logical addition, therefore, a disjunctor must be at the output of the logical circuit. Signals are supplied to it from two conjunctors, to which, in turn, one normal input signal and one inverted one (from inverters) are supplied. Example 4. Logic circuit has two inputs X and Y. Determine the logical functions F1 (X, Y) and F2 (X, Y), which are implemented at its two outputs. The F1 (X, Y) function is implemented at the output of the first conjunctor, that is, F1 (X, Y) = X&Y. At the same time, the signal from the conjunctor is fed to the input of the inverter, at the output of which the X&Y signal is realized, which, in turn, is fed to one of the inputs of the second conjunctor. The signal Xv Y from the disjunctor is fed to the other input of the second conjunctor, therefore, the function F2 (X, Y) = X&Y &, (XvY). Consider the scheme for adding two n-bit binary numbers. When the digits of the i-ro digit are added, ai and bi are added, as well as Pi-1 - the transfer from the i-1 digit. The result will be st - the sum and Pi - carry to the most significant bit. Thus, a 1-bit binary adder is a three-input, two-output device. Example 3.15. Build a truth table for a one-bit binary adder using the binary addition table. Trigger. Triggers are used to store information in the computer's RAM, as well as in the internal registers of the processor. The trigger can be in one of two stable states, which allows you to memorize, store and read 1 bit of information. The simplest trigger is the .RS trigger. It consists of two logical elements OR-NOT, which implement the logical function F9 (see table 3.1). The inputs and outputs of the elements are connected by a ring: the output of the first is connected to the input of the second and the output of the second is connected to the input of the first. The trigger has two inputs S (from the English set - setting) and I (from the English reset - reset) and two outputs Q (direct) and Q (inverse). Rice. 2 Logic circuit of the RS-flip-flop Example 3.16. Build a table describing the state of the inputs and outputs of the RS-flip-flop. If the inputs receive signals R = 0 and S = 0, then the trigger is in storage mode, the previously set values ​​are saved at the outputs Q and Q. If the signal 1 is applied to the control input S for a short time, then the trigger goes into state 1 and after the signal at the S input becomes equal to 0, the trigger will maintain this state, that is, it will store 1. When 1 is applied to the R input, the trigger will go to state 0. Applying a logical unit to both inputs S and R can lead to an ambiguous result, therefore such a combination of input signals is prohibited. Tasks for independent execution 1. There are 16 logical functions of two variables (see table 3.1). Build their logic circuits using basic logic gates: a conjunctor, a disjunctor, and an inverter. 2. Prove that the logic circuit considered in Example 3.10 is a one-bit binary half-adder (carry from the least significant bit is not taken into account). 3. Prove, by constructing a truth table, that the logical function P = (A&B) v (A &, P0) v (B & P0) determines the transfer to the most significant bit when adding binary numbers (A and B are terms, Po is the transfer from the least significant bit). 4. Prove by constructing a truth table that the logical function S = (AvBvP0) & Pv (A & .B & P0) determines the sum when adding binary numbers (A and B are terms, Po is carry from the least significant bit). 5. Build a logic circuit of a one-bit binary adder. How many basic gates are needed to implement a 64-bit binary adder? 6. How many basic logical elements make up the RAM of a modern computer with a volume of 64 Mbytes? 1. Write down the numbers in expanded form: a) A8 = 143511; d) A10 = 143.511; 6) A2 = 100111; e) A8 = 0.143511; c) A16 = 143511; f) A1e = 1AZ, 5C1. 2. Write down the following numbers in folded form: a) A10 = 9-101 + 1 * 10 + 5 "10-1 + 3-10 ~ 2; b) A16 = A-161 + 1-16 ° + 7-16" 1 + 5-16 ~ 2. 3. Are the numbers written correctly in the corresponding number systems: a) A10 = A, 234; c) A16 = 456.46; b) A8 = -5678; d) A2 = 22.2? 4. What is the minimum base of the number system if it contains the numbers 127, 222, 111? Determine the decimal equivalent of the given numbers in the found number system. 5. What is the decimal equivalent of 101012, 101018 1010116? 6. A three-digit decimal number ends with the digit 3. If this digit is moved two digits to the left, that is, the recording of a new number will begin with it, then this new number will be one more than three times the original number. Find the original number. 2.22. A six-digit decimal number begins on the left with the digit 1. If this digit is moved from the first place on the left to the last place on the right, then the value of the formed number will be three times larger than the original one. Find the original number. 2.23. Which of the numbers 1100112, 1114, 358 and 1B16 is: a) the largest; b) the smallest? 2.27 Is there a triangle whose side lengths are expressed by the numbers 12g, 1116 and 110112? 2.28 What is the largest decimal number that can be written in three digits in binary, octal, and hexadecimal notation? 2.29 "Not serious" questions. When is 2x2 = 100? When is 6x6 = 44? When is 4x4 = 20? 2.30. Write down the whole decimal numbers belonging to the following numerical intervals: a); b); v) . 2.31 There are 11,112 girls and 11,002 boys in the class. How many students are there in the class? 2.32. There are 36d students in the class, of which 21q are girls and 15q are boys. What number system was used to keep track of students? 2. 33. There are 100q fruit trees in the garden, of which 33q are apple trees, 22q pears, 16q plums and 5q cherries. In what number system are the trees counted? 2.34 There were 100q apples. After each of them was cut in half, there were 1000q halves. In the number system, with what base were the counts? 2.35 I have 100 brothers. The youngest is 1000 years old, and the oldest is 1111 years old. The eldest is in grade 1001. Could this be? 2.36 There was once a pond in the center of which a single water lily leaf grew. Every day the number of such leaves doubled, and on the tenth day the entire surface of the pond was already filled with lily leaves. How many days did it take to fill half a pond with leaves? How many leaves were there after the ninth day? 2.37. By choosing the powers of the number 2, in the sum giving the given number, convert the following numbers into the binary system: a) 5; at 12; e) 32; b) 7; d) 25; f) 33. Check the correctness of the translation using the Advanced Converter program. 2.3. Converting numbers from one number system to another 2.3.1. Converting integers from one number system to another It is possible to formulate an algorithm for converting integers from a system with base p to a system with base q: 1. Express the base of a new number system with the digits of the original number system and perform all subsequent actions in the original number system. 2. Sequentially perform division of the given number and the resulting integer quotients by the basis of the new number system until we get the quotient that is less than the divisor. 3. The resulting remainders, which are the digits of the new number system, should be brought into conformity with the alphabet of the new number system. 4. Make up a number in the new number system, writing it down, starting with the last remainder. Example 2.12. Convert the decimal number 17310 to the octal number system: ■ We get: 17310 = 2558. Example 2.13. Convert the decimal number 17310 to the hexadecimal number system: - We get: 17310 = AD16. Example 2.14. Convert decimal number 1110 to binary notation. We get: 111O = 10112. Example 2.15 Sometimes it is more convenient to write down the translation algorithm in the form of a table. Converting decimal number 36310 to binary. 2.3.2. Converting fractional numbers from one number system to another It is possible to formulate an algorithm for converting a regular fraction with base p into a fraction with base q: 1. Express the base of the new number system with the numbers of the original number system and perform all subsequent actions in the original number system. 2. Sequentially multiply the given number and the resulting fractional parts of the products on the basis of the new system until the fractional part of the product becomes equal to zero or the required precision of the number representation is achieved. 3. The resulting whole parts of the products, which are digits of a number in the new number system, should be brought in accordance with the alphabet of the new number system. 4. Make up the fractional part of the number in the new number system, starting with the whole part of the first product. Example 2.16. Convert Hexadecimal number 0.6562510. Example 2.17. Convert the number 0.6562510 to hexadecimal notation. Example 2.18. Convert Binary number system to decimal 0.562510. Example 2.19. Convert the decimal fraction 0.710 to the binary system. Obviously, this process can continue indefinitely, giving more and more new signs in the image of the binary equivalent of the number 0.710. So, in four steps we get the number 0.10112, and in seven steps the number 0.10110012, which is a more accurate representation of the number 0.710 in the binary system, and so on. Such an endless process is terminated at some step, when it is considered that the required accuracy of the number representation has been obtained. 2.3.3. Translation of arbitrary numbers Translation of arbitrary numbers, that is, numbers containing integer and fractional parts, is carried out in two stages. The whole part is translated separately, and the fractional part is translated separately. In the final record of the resulting number, the integer part is separated from the fractional comma. Example 2.20 Convert the number 17.2510 to binary notation. We translate the whole part: We translate the fractional part: Example 2.21. Convert Octal number 124.2510. 2.3.4. Converting numbers from base 2 to base 2n and back Converting integers rules. In order to write an integer binary number in the base q = 2 "number system, you need to: 1. Divide the binary number from right to left into groups of n digits in each. 2. If the last left group contains less than n digits, then it must be complement the left with zeros to the required number of digits 3. Consider each group as an n-bit binary number and write it down with the corresponding digit in the base q = 2n Example 2.22. We split the number from right to left into triads and under each of them we write down the corresponding octal digit: We get the octal representation of the original number: 5410628. Example 2.23. The number 10000000001111100001112 is converted into a hexadecimal number system. We split the number from right to left into tetrads and write down the corresponding hexadecimal digit under each of them: We get the hexadecimal representation of the original number: 200F8716. Translation of fractional numbers. In order to write a fractional binary number in the base q = 2 "number system, you need to: 1. Divide the binary number from left to right into groups of n digits in each. 2. If the last right group contains less than n digits, then its it is necessary to complete with zeros on the right to the required number of digits 3. Consider each group as an n-bit binary number and write it down with the corresponding digit in the base q = 2n. Example 2.24. to the right into triads and under each of them we write down the corresponding octal digit: We get the octal representation of the original number: 0.5428 Example 2.25 We convert the number 0.1000000000112 into the hexadecimal number system. the corresponding hexadecimal digit: We obtain the hexadecimal representation of the original number: 0.80316. Translation of arbitrary numbers. the second binary number is written in the base q - 2n, you need: [1. Divide the whole part of the given binary number from right to left, and fractional - from left to right into groups of n digits in each. 2. If there are less than n digits in the last left and / or right groups, then they must be supplemented with zeros on the left and / or right to the required number of digits. 3. Consider each group as an n-bit binary number and write it down with the corresponding digit in the base q = 2n. Example 2.26. The number 111100101,01112 is converted into the octal number system. We split the integer and fractional parts of the number into triads and write down the corresponding octal digit under each of them: We get the octal representation of the original number: 745.34S. Example 2.27. The number 11101001000,110100102 is converted into a hexadecimal number system. We split the integer and fractional parts of the number into tetrads and write down the corresponding hexadecimal digit under each of them: We get the hexadecimal representation of the original number: 748, D216. Converting numbers from base q = 2n to the binary system.In order for an arbitrary number written in base q = 2 to be converted to a binary number system, you need to replace each digit of this number with its n-digit equivalent in the binary number system ... Example 2.28. Let's translate the hexadecimal number 4АС351б into binary notation. In accordance with the algorithm: i We get: 10010101100001101012. Tasks for self-fulfillment 2.38. Fill in the table, in each line of which the same integer must be written in different number systems. 2.39. Fill in the table, in each line of which the same fractional number must be written in different number systems. 2.40. Fill in the table, in each line of which the same arbitrary number (the number can contain both integer and fractional parts) must be written in different number systems. 2.4. Arithmetic operations in positional number systems

Arithmetic operations in the binary number system.


Example 2.29. Let's look at some examples of adding binary numbers:

Subtraction. When performing a subtraction operation, the smaller number is always subtracted from the largest in absolute value and the corresponding sign is put. In the subtraction table, 1 with a dash means a loan in the most significant bit.


Example 2.31. Let's look at some examples of binary multiplication:

You can see that multiplication comes down to multiplication shifts and additions.

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


Addition in other number systems. Below is the octal addition table:

2.42. Arrange the signs of arithmetic operations so that the following equalities in the binary system are true:

Write the answer for each number in the indicated and decimal notation systems. 2.44. Which number precedes each of the data:

2.45. Write down the integers belonging to the following numerical ranges:

a) in the binary system;

b) in octal system;

c) in hexadecimal system.

Write the answer for each number in the indicated and decimal notation systems.



2.47. Find the arithmetic mean of the following numbers:

2.48 The sum of octal numbers 17 8 + 1700 8 + 170,000 3 + 17000000 8 +
+ 1700000000 8 was converted to hexadecimal notation.
Find in the record the number equal to this sum, the fifth digit from the left.


Recover the unknown numbers indicated by a question mark in
in the following examples for addition and subtraction, first defining
le, in which system the numbers are depicted.
  1. Place of the lesson: Grade 9-3 lesson of the studied section
  2. Topic of the lesson: Arithmetic operations in the binary number system.

Lesson type: lecture, conversation, independent work.

Lesson objectives:

Didactic: to introduce the rules for performing arithmetic operations (addition, multiplication, subtraction) in the binary number system.

Educational: instilling skills of independence in work, education of accuracy, discipline.

Developing: development of attention, memory of students, development of the ability to compare the information received.

Interdisciplinary connections: Mathematics:

Training equipment (equipment) classes:projector, table, cards with tasks.

Methodological support of the lesson:PowerPoint presentation.

Lesson plan

  1. Organizational moment (2 min).
  2. Repetition (10)
  3. Explaining the new material (15 min)
  4. Consolidation of the passed material (10 min)
  5. homework assignment
  6. Reflection (2 min)
  7. Summing up (2 min)

During the classes

  1. Organizing time
  2. Knowledge update.We continue to study the topic of the number system and the purpose of our today's lesson will be to learn how to perform arithmetic operations in the binary number system, namely, we will consider with you the rule for performing such operations as addition, subtraction, multiplication, division.
  3. Knowledge check (frontal survey).

Let's remember with you:

  1. What is called a number system?
  2. What is called the base of the number system?
  3. What is the base of the binary number system?
  4. Indicate which numbers are spelled with errors and argue the answer:
    123
    8, 3006 2, 12ААС09 20, 13476 10,
  5. What is the minimum base the number system should have if numbers can be written in it: 10, 21, 201, 1201
  6. What digit does an even binary number end in?
    What digit does an odd binary number end in?

4 . The study of new material is accompanied by a presentation

/ Annex 1/

The teacher explains the new topic on the slides of the presentation, the students take notes and complete the tasks suggested by the teacher in the notebook.

Of all the positional systems, the binary number system is especially simple. Consider performing basic arithmetic operations on binary numbers.

All positional number systems are "the same", namely, in all of them arithmetic operations are performed according to the same rules:

one . the same laws of arithmetic are true: commutative, associative, distributive;

2. The rules of addition, subtraction and multiplication by a column are valid;

3. the rules for performing arithmetic operations are based on the addition and multiplication tables.

Addition

Let's look at some examples of addition.

When adding two digits in a column from right to left in the binary number system, as in any positional system, only one can go to the next digit.

The result of adding two positive numbers has either the same number of digits as the maximum of the two terms, or one more digit, but this digit can only be one.

1011022+111112=?

1110112+110112=?

Subtraction

Independent work of students in a notebook to consolidate the material

101101 2 -11111 2 =?

110011 2 -10101 2 =?
Multiplication
Let's look at examples of multiplication.

The multiplication operation is performed using the multiplication table according to the usual scheme (used in the decimal number system) with sequential multiplication of the multiplier by the next digit of the multiplier.
Consider examples of multiplication
When performing multiplication in example 2, three units are added 1 + 1 + 1 = 11 in the corresponding bit, 1 is written, and the other unit is transferred to the most significant bit.
In the binary number system, the multiplication operation is reduced to the shifts of the multiplicand and the addition of intermediate results.
Division

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

Consider a division example

Strengthening (independent work of students using cards is performed in a notebook) / Appendix 2 /

For students who have completed independent work in a short period of time, an additional task is offered.

5. Homework

2. Learn the rules for performing arithmetic operations in the binary number system, learn tables of addition, subtraction, multiplication.

3. Follow the steps:

110010+111,01

11110000111-110110001

10101,101*111

6 Reflection

Today in the lesson the most informative for me was ...

I was surprised that ...

I can apply the knowledge gained today in the lesson ...

7. Lesson summary

Today we have learned how to perform arithmetic operations in the binary number system (assigning grades for a lesson).

Slide captions:

Lesson topic: "Arithmetic operations in positional number systems" Computer science teacher Fedorchenko Marina Valentinovna MOU Berezovskaya secondary school s Berezovka Taishet district Irkutsk Region Let's remember with you: What is the number system? numbers are written with errors and argue the answer: 1238, 30062, 12ААС0920, 1347610, What is the minimum base number system should have if numbers can be written in it: 10, 21, 201, 1201 What digit does an even binary number end in? What digit does an odd binary end up with? number?
Laplace wrote about his attitude to the binary (binary) number system of the great mathematician Leibniz: “In his binary arithmetic, Leibniz saw the prototype of creation. It seemed to him that one represents the divine principle, and zero represents non-being, and that the supreme being creates everything from non-being in exactly the same way as one and zero in his system express all numbers. " These words emphasize the versatility of the two-character alphabet. All positional number systems are "the same", namely, in all of them arithmetic operations are performed according to the same rules:
the same laws of arithmetic are valid: --commutative (transposable) m + n = n + mm n = n m associative (combinational) (m + n) + k = m + (n + k) = m + n + k (m n) k = m (n k) = m n k distributive (distributive) (m + n) k = m k + n k
the rules of addition, subtraction and multiplication by a column are true;
the rules for performing arithmetic operations are based on the addition and multiplication tables.
Addition in positional number systems Of all positional systems, the binary number system is especially simple. Consider performing basic arithmetic operations on binary numbers. All positional number systems are "the same", namely, in all of them arithmetic operations are performed according to the same rules: the same are true: commutative, associative, distributive; the rules of addition, subtraction and multiplication by a column are true; the rules for performing arithmetic operations are based on on tables of addition and multiplication.
When adding two digits in a column from right to left in the binary number system, as in any positional system, only one can go to the next digit. The result of adding two positive numbers has either the same number of digits as the maximum of the two terms, or one more digit, but this digit can only be one. Consider examples Solve examples yourself:
1011012 + 111112
1110112 + 110112
1001100
1010110
When performing a subtraction operation, the smaller number is always subtracted from the larger in absolute value, and the corresponding sign is put on the result.
Subtraction Consider examples Examples:
1011012– 111112
1100112– 101012
1110
11110
Multiplication in positional number systems The multiplication operation is performed using the multiplication table according to the usual scheme (used in the decimal number system) with sequential multiplication of the multiplied by the next digit of the factor. Let's consider examples of multiplication. Let's look at some examples Let's look at an example for division
Let's solve examples:
11012 1112

111102:1102=
1011011
101
Homework 1. & 3.1.22. Learn the rules for performing arithmetic operations in the binary number system, learn tables of addition, subtraction, multiplication. 3. Follow the steps: 110010 + 111,0111110000111-11011000110101,101 * 111 Reflection Today in the lesson the most informative for me was ... I was surprised that ... I can apply the knowledge I got today in the lesson ...

Arithmetic operations in positional number systems

Let's consider in more detail the arithmetic operations in the binary number system. The arithmetic of the binary number system is based on the use of tables of addition, subtraction and multiplication of numbers. Arithmetic operands are in the top row and in the first column of tables, and the results are at the intersection of columns and rows:

Let's consider each operation in detail.

Addition. Binary addition table is extremely simple. Only in one case, when the addition is performed 1+1, there is a transfer to the most significant category. ,

Subtraction. When performing a subtraction operation, the smaller number is always subtracted from the largest in absolute value and the corresponding sign is put. In the subtraction table, 1 with a dash means a loan in the most significant bit.

Multiplication. The multiplication operation is performed using the multiplication table according to the usual scheme used in the decimal number system with sequential multiplication of the multiplied 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.