Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
laboratory.doc
Скачиваний:
6
Добавлен:
01.07.2025
Размер:
5.68 Mб
Скачать

Adding Binary Numbers

When one add two binary numbers together, one can use the same methodology that is used in the decimal number system, but using 2 as a base. In the decimal system 1+1=2, but in binary system 1+1=10 (remember that the binary number 10 represents the same quantity as the decimal number 2).

The binary addition is performed with the help of following four rules:

  1. 0+0=0

  2. 1+0=1

  3. 0+1=1

  4. 1+1=10, implying that one added to one gives 2, the decimal equivalent of 10 being 2.

Some binary addition examples are shown below:

Example1: 10 +  11 101

Example2: 10001 +  111  11000

Addition of negative numbers are shown below -2 +  -19  -21 Example 3:

-10 + -10011 -10101

Subtracting Binary Numbers

Binary subtraction is based on the following four rules

  1. 0−0=0

  2. 1−0=1

  3. 1−1=0

  4. 10−1=1

Example for binary substation is given below:

Example1: 1011  – 1001  0010

Example2:

110  – 11 011

Multiplying Binary Numbers

Multiplication of binary numbers obeys the following four rules:

  1. 0×0=0

  2. 1×0=0

  3. 0×1=0

  4. 1×1=1

Binary multiplication of two large numbers consisting of several digits is performed in a manner similar to decimal multiplication. As an example let us multiply a binary number 10111 by the binary number 110 as follows.

10111

110

00000

10111

10111 10001010

Dividing Binary Numbers

Division of binary number is also carried out along the same line as the division of decimal number.  In below example, the binary number 10100 (twenty) is divided by 100 (four) 100)10100 (101

100

100

100 000 The quotient is 101 (five)

The octal number system (base 8). An older computer base system is "octal", or base eight. The digits in octal math are 0, 1, 2, 3, 4, 5, 6, and 7. The value "eight" is written 108.

Convert 35710to the corresponding base-eight number.

We will do the usual repeated division, this time dividing by 8 at each step:

Then the corresponding octal number is 5458.

Convert 5458 to the corresponding decimal number.

We will follow the usual procedure, counting off the digits from the RIGHT, starting at zero:

digits:

5  4   5

numbering:

2  1   0

Then we will do the addition and multiplication:

5×82 + 4×81 + 5×80  = 5×64 + 4×8 + 5×1  = 320 + 32 + 5 = 357

Then the corresponding decimal number is 35710.

The Hexadecimal number system (base 16). The number system with base sixteen is called the Hexadecimal number system (HEX). We use a set of symbols to represent the numbers in this system. The first ten of these are the decimal digits 0, 1, 2, 3...., 9 having the same significance as in the decimal number system. The remaining six numbers are the English alphabets A, B, C, D, E and F and they are equivalent to the decimal number 10, 11, 12, 13, 14 and 15 respectively.That is, counting in hexadecimal, the sixteen "numerals" are:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.

In other words, A is "ten" in "regular" numbers, B is "eleven", C is "twelve", D is "thirteen", E is "fourteen", and "F" is fifteen.  It is this use of letters for digits that makes hexadecimal numbers look so odd at first. But the conversions work in the usual manner.

Convert 35710 to the corresponding hexadecimal number.

Here, we will divide repeatedly by 16, keeping track of the remainders as we go. (You might want to use some scratch paper for this.)

Reading off the digits, starting from the top and wrapping around the right-hand side, we see that 35710 = 16516.

Convert 16516 to the corresponding decimal number.

List the digits, and count them off from the RIGHT, starting with zero:

digits:

1  6   5

numbering:

2  1   0

Remember that each digit in the hexadecimal number represents how many copies you need of that power of sixteen, and convert the number to decimal:

1×162 + 6×161 + 5×160  = 1×256 + 6×16 + 5×1  = 256 + 96 + 5  = 357

Then 16516 = 35710.

Convert 6393310 to the corresponding hexadecimal number.

We will divide repeatedly by 16, keeping track of my remainders:

From the long division, We can see that the hexadecimal number will have a "fifteen" in the sixteen-cubeds column, a "nine" in the sixteen-squareds column, an "eleven" in the sixteens column, and a "thirteen" in the ones column. But we cannot write the hexadecimal number as "1591113", because this would be confusing and imprecise. So we will use the letters for the "digits" that are otherwise too large, letting "F" stand in for "fifteen", "B" stand in for "eleven", and "D" stand in for "thirteen".

Then 6393310 = F9BD16.

Convert F9BD to decimal notation.

We will list out the digits, and count them off from the RIGHT, starting at zero:

digits:

F  9   B  D

numbering:

3  2    1  0

Actually, it will probably be helpful to redo this, converting the alphabetic hexadecimal "digits" to their corresponding "regular" decimal values:

digits:

15    9  11  13

numbering:

3    2   1    0

Now we will do the multiplication and addition:

15×163 + 9×162 + 11×161 + 13×160 = 15×4096 + 9×256 + 11×16 + 13×1 =

61440 + 2304 + 176 + 13 = 63933

As expected, F9BD = 6393310.

Practical exercises

  1. Convert 133 from decimal to binary

  2. Convert 91 from decimal to base 2

  3. Convert 55 from base 10 to binary

  4. Convert 0100 0111 0101 1001 from base 2 to base 16

  5. Convert 8cb1 from base 16 to base 2

  6. Convert 010 010 from binary to base 8

  7. Convert 110 from decimal to binary

  8. Convert 001 010 001 from base 2 to octal

  9. Convert 135 from decimal to base 2

  10. Convert 0101 1111 from binary to base 10

  11. Convert any decimal number between 0 and 255 into binary.

  12. Convert any binary number between 0 and 11111111 into decimal (i.e. 0 to 255)

  13. Convert any binary number from 0 to 111111111 into octal

  14. Convert any octal number from 0 to 777 into binary

  15. Convert any binary number from 0 to 1111 1111 1111 1111 into hex

  16. Convert any hex number from 0 to FFFF into binary

  17. Convert 2db1 from base 16 to base 2

  18. Convert 011110 from binary to base 8

  19. Convert 1025 from decimal to binary

  20. Convert 001 01001010 from base 2 to octal

  21. Convert 286 from decimal to base 2

  22. Convert 0101000111 from binary to base 10

  23. Convert any decimal number between 255 and 555 into binary.

  24. Convert 328 from decimal to binary

  25. Convert 0101111 from base 2 to octal

Control questions:

  1. What is principle of the Von Neumann architecture?

  2. Give definition to CPU?

  3. Main logic elements of computer?

  4. Name the main characteristics of memory?

  5. What is auxiliary memory?

  6. What is number system?

  7. How to convert decimal number to any number system?

What digits use in octal number system?

List of recommended references

  1. June J. Parsons and Dan Oja, New Perspectives on Computer Concepts 16th Edition - Comprehensive, Thomson Course Technology, a division of Thomson Learning, Inc Cambridge, MA, COPYRIGHT © 2014.

  2. Lorenzo Cantoni (University of Lugano, Switzerland) James A. Danowski (University of Illinois at Chicago, IL, USA) Communication and Technology, 576 pages.

  3. Craig Van Slyke Information Communication Technologies: Concepts, Methodologies, Tools, and Applications (6 Volumes). ISBN13: 9781599049496, 2008, Pages: 4288

  4. Brynjolfsson, E. and A. Saunders (2010). Wired for Innovation: How Information Technology Is Reshaping the Economy. Cambridge, MA: MIT Press

  5. Kretschmer, T. (2012), "Information and Communication Technologies and Productivity Growth: A Survey of the Literature", OECD Digital Economy Papers, No. 195, OECD Publishing.

Laboratory work №3

DETERMINATION OF THE OPERATING SYSTEM PROPERTIES. WORKING WITH FILES AND DIRECTORIES.

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