By the end of this unit, you should be able to



Download 0,99 Mb.
bet2/2
Sana06.11.2022
Hajmi0,99 Mb.
#861351
1   2
Bog'liq
Unit 2-Number Systems

Binary Number System


Binary or base 2 number systems use Bit (binary digit): 2 digits, 0 and 1

Binary to decimal



1.1.3 Octal Number System


Positional Notation: Octal





From Base 8 to Base 10



72638

= 3,76310










Power

83

82

81

80




512

64

8

1




x 7

x 2

x 6

x 3

Sum for Base 10

3,584

128

48

3


1.1.4 Hexadecimal Number System

Hex is easier to read and write than binary. Modern computer operating systems and networks


present variety of troubleshooting data in hex format.




Hexadecimal to decimal





1.2 Converting from Base 10



Power
Base

8

7

6

5

4

3

2

1

0

2

256

128

64

32

16

8

4

2

1

8










32,768

4,096

512

64

8

1

16













65,536

4,096

256

16

1



1.2.1 From Base 10 to Base 2



1.2.2 From Base 10 to Base 8
To convert a decimal (base 10) number to Base-8 (Octal) number we
1) Divide the given decimal number by 8.
2) Write the quotient and remainder and continue the division till quotient becomes 0.
The remainders are taken and written from bottom to top form the base-8 number that is starting from the most significant digit to the least significant digit.

Example :


Given: Base 10 number, .
To find the base 8 numbers:
8 | 6 8 9
8 | 8 6 - 1
8 | 1 0 - 6
8 | 1 - 2
8 | 0 - 1

Therefore, the required base 8 number,


.


      1. From Base 10 to Base 16






1.3 From Base 16 to Base 2

We can use the nibble approach





Base 16

1

F

6

7

Base 2

0001

1111

0110

0111

Convert Binary to Hex

Example: Convert 1001 1110 0111 0000 to Hex


After grouping follow the procedure as discussed in the previous section use the symbols of Hex


number system like 13=E


1001 1110 0111 0000


9 E 7 0

Example: Convert 10010100110000 to Hex


10 0101 0011 0000


0010 0101 0011 0000
2 5 3 0
Convert Octal to Binary

For each of the Octal digit write its binary equivalent.


Example: Convert 2570 (octal) to binary


010 101 111 000


1.4 Counting in Base 2

Binary Number

Equivalent

Decimal Number

8’s (23)

4’s (22)

2’s (21)

1’s (20)

0










0 x 20

0

1










1 x 20

1

10







1 x 21

0 x 20

2

11







1 x 21

1 x 20

3

100




1 x 22







4

101




1 x 22




1 x 20

5

110




1 x 22

1 x 21




6

111




1 x 22

1 x 21

1 x 20

7

1000

1 x 23










8

1001

1 x 23







1 x 20

9

1010

1 x 23




1 x 21




10


1.4 Arithmetic (Addition and Subtraction)



Base

Problem

Largest Single Digit

Decimal

6
+3

9

Octal

6
+1

7

Hexadecimal

6
+9

F

Binary

1
+0

1




Base

Problem

Carry

Answer

Decimal

6
+4

Carry the 10

10

Octal

6
+2

Carry the 8

10

Hexadecimal

6
+A

Carry the 16

10

Binary

1
+1

Carry the 2

10

1.4.1 Binary Arithmetic


Rules of Binary Addition


For example,

00011010 + 00001100 = 00100110


1 1


carries

0 0 0 1 1 0 1 0

=

26(base 10)

+ 0 0 0 0 1 1 0 0

=

12(base 10)

0 0 1 0 0 1 1 0

=

38(base 10)

 


00010011 + 00111110 = 01010001


1 1 1 1 1


carries

0 0 0 1 0 0 1 1

=

19(base 10)

+ 0 0 1 1 1 1 1 0

=

62(base 10)

0 1 0 1 0 0 0 1

=

81(base 10)

Note: The rules of binary addition (without carries) are the same as the truths of the XOR gate.

    • EXCLUSIVE-OR

      • Output is “1” only if either input, but not both inputs, is a “1”




1

1

1

1

1













1

1

0

1

1

0

1

+







1

0

1

1

0

1

0

0

0

0

0

1

1


Rules of Binary Subtraction


  • 0 - 0 = 0

  • 0 - 1 = 1, and borrow 1 from the next more significant bit

  • 1 - 0 = 1

  • 1 - 1 = 0

For example, 00100101 - 00010001 = 00010100


0


borrows

0 0 1 10 0 1 0 1

=

37(base 10)

- 0 0 0 1 0 0 0 1

=

17(base 10)

0 0 0 1 0 1 0 0

=

20(base 10)

 


00110011 - 00010110 = 00011101


0 10 1


borrows

0 0 1 1 0 10 1 1

=

51(base 10)

- 0 0 0 1 0 1 1 0

=

22(base 10)

0 0 0 1 1 1 0 1

=

29(base 10)



1.4.2 Octal Arithmetic
Addition of Octal Numbers
The addition of octal numbers is not difficult provided you remember that anytime the sum of two digits exceeds 7, a carry is produced. Compare the two examples shown below:


Table 1.1. - Octal Addition Table
If you use the concepts of addition you have already learned, you are ready to add octal numbers.
Work through the solutions to the following problems:

Subtraction of Octal Numbers
The subtraction of octal numbers follows the same rules as the subtraction of numbers in any other number system. The only variation is in the quantity of the borrow.
In the decimal system, you had to borrow a group of 10. In the binary system, you borrowed a group of 2. In the octal system you will borrow a group of 8.
Consider the subtraction of 1 from 10 in decimal, binary, and octal number systems:

In each example, you cannot subtract 1 from 0 and have a positive difference. You must use a borrow from the next column of numbers.

Let's examine these problems:



When you use the borrow, the column you borrow from is reduced by 1, and the amount of the borrow is added to the column of the minuend being subtracted.
The following examples show this procedure:

In the octal example 78 cannot be subtracted from 68, so you must borrow from the 4. Reduce the 4 by 1 and add 108 (the borrow) to the 68 in the minuend.
By subtracting 78 from 168, you get a difference of 78. Write this number in the difference line and bring down the 3.
You may need to refer to table 1-1, the octal addition table, until you are familiar with octal numbers. To use the table for subtraction, follow these directions. Locate the subtrahend in column Y. Now find where this line intersects with the minuend in area Z. The remainder, or difference, will be in row X directly above this point.


1.4.3 Hexadecimal Arithmetic
Addition of Hex Numbers
Study the hex addition table in table 1-2. Using the table, add 7 and 7. Locate the number 7 in both columns X and Y. The point in area Z where these two columns intersect is the sum; in this case 7 + 7 = E.
As long as the sum of two numbers is 15 or less, only one symbol is used for the sum. A carry will be produced when the sum of two numbers is 16 or greater, as in the following examples:


Table 1-2. - Hexadecimal Addition Table

Use the addition table and follow the solution of the following problems:



In this example each column is straight addition with no carry. Now add the addend (78416) and the sum (BDA16) of the previous problem:

Here the sum of 4 and A is E. Adding 8 and D is 1516; write down 5 and carry a 1. Add the first carry to the 7 in the next column and add the sum, 8, to B. The result is 1316; write down 3 and carry a 1. Since only the last carry is left to add, bring it down to complete the problem.

Subtraction of Hex Numbers
In the preceding sections you learned all the rules for subtraction. Now you need only to apply those rules to a new number system. The symbols may be different and the amount of the borrow is different, but the rules remain the same.
Use the hex addition table (table 1-2) to follow the solution of the following problems:

Working from left to right, first locate the subtrahend (2) in column Y. Follow this line across area Z until you reach C. The difference is located in column X directly above the C - in this case A. Use this same procedure to reach the solution:

Now examine the following solutions:



In the previous example, when F was subtracted from 1E, a borrow was used. Since you cannot subtract F from E and have a positive difference, a borrow of 1016 was taken from the next higher value column. The borrow was added to E, and the higher value column was reduced by 1.

Exercises:
  1. Convert the following base 10, decimal numbers to base 2, binary numbers.


A) 33
B) 87
C) 312
D) 972
  1. Convert the following base 2, binary numbers to base 10 decimal numbers.





      1. 11001112




      1. 11100102




      1. 10012



  1. Convert the following base 10, decimal numbers to base 8, octal numbers.





  1. 118




  1. 2569




  1. 1000




  1. 45

  1. Convert the following base 8, octal numbers to base 10, decimal numbers.





        1. 4678




        1. 25438




        1. 7778




        1. 358



  1. Convert the following base 10, decimal numbers to base 16, hexadecimal numbers.





  1. 5589




  1. 198




  1. 69

  1. Convert the following base 16, Hexadecimal numbers to base 10, decimal numbers.





  1. 790316




  1. 9C516




  1. ABCD16




  1. 114716

  1. Convert the following octal numbers to their hexadecimal equivalent.





  1. 4068




  1. 345268




  1. 5558



  1. Convert the following Hexadecimal numbers to their Octal equivalent.





  1. CAD16




  1. 289916




  1. 1ABC16



  1. Perform the following additions:





  1. 111112 + 111112




  1. 100101102 + 101101112




  1. 4678 + 3668




  1. 12758 + 7748




  1. AAA16 + 35916




  1. 18326616 + 10B7F16



  1. Perform the following subtractions:





  1. 100002 - 11112




  1. 100101102 - 111112




  1. 4678 - 3668




  1. 12758 - 7748




  1. AAA16 - 35916




  1. 18326616 - 10B7F16








MDIS-DIT 1- Mathematics for computing

Download 0,99 Mb.

Do'stlaringiz bilan baham:
1   2




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©www.hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish