Binary Number System and Conversion System, Lecture notes of Computer science

Understanding Binary System and its conversion

Typology: Lecture notes

2019/2020

Available from 04/26/2022

ZelRienne
ZelRienne 🇵🇭

1 document

1 / 14

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
LESSON 1 – Binary Systems
Understanding Binary Systems
The binary system is the positional numeration system to the base 2.
Binary notation uses only two symbols: 0 and 1. In any position of the
notation, the symbol 0 represents the absence of an assigned value, the
symbol 1, represents the presence of an assigned value. The symbols used in
binary notation are called binary digits (bits).
Table below shows binary digits' value.
Position
9
8
7
6
5
4
3
2
1
0
Power of 2
29
28
27
26
25
24
23
22
21
20
Value
512
256
128
64
32
16
8
4
2
1
Position
0
-1
-2
-3
-4
-5
Power of 2
20
2-1
2-2
2-3
2-4
2-5
Value
1
0.5
0.25
0.125
0.0625
0.03125
Understanding Decimal Systems
The decimal system for counting has been so widely used from time
immemorial. It is based upon the ten fingers of man. This system is nothing
more than a code where each distinct quantity is assigned a symbol. In the
decimal system the following digits are used: 0,1,2,3,4,5,6,7,8, and 9. These
symbols are called the Arabic numerals.
Table below shows decimal digits' value.
6
5
4
3
2
1
0
106
105
104
103
102
101
100
1,000,000
100,000
10,000
1,000
100
10
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download Binary Number System and Conversion System and more Lecture notes Computer science in PDF only on Docsity!

LESSON 1 – Binary Systems

Understanding Binary Systems

The binary system is the positional numeration system to the base 2. Binary notation uses only two symbols: 0 and 1. In any position of the notation, the symbol 0 represents the absence of an assigned value, the symbol 1, represents the presence of an assigned value. The symbols used in binary notation are called binary digits (bits). Table below shows binary digits' value. Position 9 8 7 6 5 4 3 2 1 0 Power of 2 (^) 29 28 27 26 25 24 23 22 21 20 Value 512 256 128 64 32 16 8 4 2 1 Position^0 -1 -2 -3 -4 - Power of 2 (^) 20 2 -1^2 -2^2 -3^2 -4^2 - Value 1 0.5 0.25 0.125 0.0625 0.

Understanding Decimal Systems

The decimal system for counting has been so widely used from time immemorial. It is based upon the ten fingers of man. This system is nothing more than a code where each distinct quantity is assigned a symbol. In the decimal system the following digits are used: 0,1,2,3,4,5,6,7,8, and 9. These symbols are called the Arabic numerals. Table below shows decimal digits' value. Position^6 5 4 3 2 1 Power of 10 (^) 106 105 104 103 102 101 100 Value 1,000,000 100,000 10,000 1,000 100 10 1

Position 0 -1 -2 -3 -4 - Power of 10 (^) 100 10 -1^10 -2^10 -3^10 -4^10 - Value 1 0.1 0.01 0.001 0.0001 0.

Understanding Octal Systems

The octal system was adapted because of the difficulty of dealing with long strings of binary 0s and 1s in converting them into decimals. Binary numbers are extremely awkward to read or handle since it requires many more positions for data than any other numbering system. The octal system overcomes this problem since it is essentially a shorthand method for replacing groups of three binary digits by a single octal digit. The octal system also uses a positional notation just as in the decimal and the binary number system. The eight basic digits of the octal system are: 0,1,2,3,4,5,6, and 7. These digits have exactly the same physical meaning as decimal symbols. Table below shows octal digits' value. Position 7 6 5 4 3 2 1 0 Power of 8 (^) 87 86 85 84 83 82 81 80 Value 2,097,152 262,144 32,768 4,096 512 64 8 1 Position 0 -1 -2 - Power of 8 (^) 80 8 -1^8 -2^8 - Value^1 0.125 0.015625 0.

Understanding Hexadecimal Systems

Hexadecimal number system provides another convenient and simple method for expressing values represented by binary numerals. This system is a combination of the ten numbers, 0 through 9, and a choice of six letters of the alphabet, which are also treated as numbers. The letters representing digits 10 through 15 are the alphabetic sequence A through F. Table below shows hexadecimal digits' value.

Conversion Between Number Bases

Binary - Decimal Conversion

Binary numerals can be converted to decimal by the use of expanded notation. When this approach is used, the position values of the original numeral are written out. Study the following examples. a.) 110 2 = (?) 10 1102 = 1x2^2 + 1x2^1 + 0x2^0 = 4 + 2 + 0 = 6 10 Therefore: 1102 = 6 10 b.) 110110 2 = (?) 10 1101102 = 1x 5

  • 1x 4
  • 0x 3
  • 1x 2
  • 1x 1
  • 0x 0 = 32 + 16 + 0 + 4 + 2 + 0 = 54 10 Therefore: 1101102 = 54 10

Binary - Octal Conversion

It is important to group the bits in threes, starting at the binary point, then converting each group of three to its octal equivalent. Zeros are added to each end to make a complete group. Refer to the given table for the equivalent octal value of each 3-bit binary group. Following are some illustrative problems. a.) 111101100 2 = (?) 8 grouping the bits into threes: 111 101 100 2 7 5 4 Therefore:

b.) 101110010101001 2 = (?) 8 grouping the bits into threes: 101 110 010 101 001 2 5 6 2 5 1 Therefore: 1011100101010012 = 56251 8

Binary - Hexadecimal Conversion

When converting binary to hexadecimal equivalents, the binary number is first partitioned into 4-bit sequences, beginning on the right, and then replaced by its hexadecimal equivalent. Zeroes may be added to make the number of digits a multiple of four. Refer to the given table for the equivalent hexadecimal value of each 4-bit binary group. The following conversions are given to illustrate this process. a.) 101011100010 2 = (?) 16 grouping the bits into fours: 1010 1110 0010 2 A E 2 Therefore: 1010111000102 = AE2 16 b.) 10010011011110111100 2 = (?) 16 grouping the bits into fours: 1001 0011 0111 1011 1100 2 9 3 7 B C Therefore: 100100110111101111002 = 937BC 16

Decimal - Binary Conversion

To convert decimal whole numbers to binary is to divide that number repeatedly by 2. The division operation is repeated until the quotient is zero. The remainders, written in reverse of the order in which they were obtained,

is divided by 16 and noting the remainders. The hexadecimal equivalent is the sequence of remainders in reverse order. It should be remembered that remainders greater than 9 have to be changed to its equivalent hexadecimal digit. The following example illustrate the conversion. a.) 8749 10 = (?) 16 Repeated Division Quotients Remainders 8749/16 =546 13 (D) 546/16 =34 2 34/16 = 2 2 2/16 = 0 2 (read) Therefore: 874910 = 222D 8

Octal - Binary Conversion

The most important use of octal numbers lies in octal-binary conversions. Refer to the given table to see the relationship between octal and binary numbers. With this tabulation, any octal number may be converted to its binary equivalent. Note that each octal digit is converted one at a time to its binary equivalent. The following examples are given to illustrate the conversion process. a.) 652 8 = (?) 2 since, 68 = 110 2 , 5 8 = 101 2 , and 2 8 = 010 2 Therefore: 6528 = 110101010 2 b.) 72061 8 = (?) 2 since, 78 = 111 2 , 2 8 = 010 2 , 0 8 = 000 2 , 6 8 = 110 2 , and 1 8 = 001 2 Therefore: 720618 = 111010000110001 2

Octal - Decimal Conversion

In the octal number system each digit corresponds to a power of 8 corresponding to a positional notation of each digit. To convert from octal to

decimal, multiply each octal digit by its positional value and add the resulting products. Following are examples to show this conversion process. a.) 145 8 = (?) 10 1458 = 1x8^2 + 4x8^1 + 5x8^0 = 64 + 32 + 5 = 101 10 b.) 73201 8 = (?) 10 732018 = 7x 4

  • 3x 3
  • 2x 2
  • 0x 1
  • 1x 0 = 28,672 + 1,536 + 128 + 0 + 1 = 30,337 10

Octal - Hexadecimal Conversion

In the octal to hexadecimal conversion, convert first octal numbers to binary. The resulting binary numbers will be grouped into fours, starting from the right, then refer to the given table to get the resulting hexadecimal equivalent. The following example will show the conversion process. a.) 573 8 = (?) 16 since, 58 = 101 2 , 7 8 = 111 2 , and 3 8 = 110 2 so, 2738 = 101111110 2 ; add three zeros at the left to make it into multiples of four 2738 = 000101111110 2 grouping the bits into fours: 0001 0111 1110 2 1 7 E Therefore: 1011111102 = 17E 16

Hexadecimal - Binary Conversion

The conversion from hexadecimal to binary is a simple procedure and easily done by replacing each hexadecimal digit by its 4-bits equivalent using the given table. The following examples are given to illustrate the conversion

a.) A5E 16 = (?) 8 since, A 16 = 1010 2 , 5 16 = 0101 2 , and E 16 = 1110 2 so, A5E 16 = 101001011110 2 grouping the bits into threes: 101 001 011 110 2 5 1 3 6 Therefore: 1010010111102 = 5136 8

Binary - Decimal Conversion of Fraction

ex. 0.1011 2 = (?) 10 0.1011 2 = 1x2-1^ + 0x2-2^ + 1x2-3^ + 1x2- = 0.5 + 0 + 0.125 + 0. = 0.6875 10

Binary - Octal Conversion of Fraction

ex. 0.00110110 2 = (?) 8

  1. 001101100 2 ; add one zero at the right to make it into multiples of three grouping the bits into threes: (starting from the binary point) 001 101 100 1 5 4 Therefore: 0.00110110 2 = 0.154 8

Binary - Hexadecimal Conversion of

Fraction ex. 0.00011010111 2 = (?) 16

  1. 000110101110 2 ; add one zero at the right to make it into multiples of four grouping the bits into fours: (starting from the binary point) 0001 1010 1110 1 A E Therefore: 0.00011010111 2 = 0.1AE 16

Decimal - Binary Conversion of Fraction

ex. 0.40625 10 = (?) 2 (read) Repeated Multiplication Products Overflows 0.40625x2 =0.8125 0 0.8125x2 =1.625 1 0.625x2 =1.25 1 0.25x2 =0.5 0 0.5x2 =1.0 1 Therefore: 0.40625 10 = 0.01101 2

Decimal - Octal Conversion of Fraction

ex. 0.2575 10 = (?) 8 (read) Repeated Multiplication Products Overflows 0.2575x8 =2.06 2 0.06x8 =0.48 0 0.48x8 =3.84 3 0.84x8 =6.72 6 0.72x8 =5.76 5 (non-terminating) Therefore: 0.2575 10 = 0.20365 8

Decimal - Hexadecimal Conversion of Fraction

ex. 0.18425 10 = (?) 16 (read)

grouping the bits into fours: (starting from the binary point) 1100 0111 1000 C 7 8 Therefore: 0.617 8 = 0.C78 16

Hexadecimal - Binary Conversion of Fraction

ex.. 0.C7 16 = (?) 2 since, C 16 = 1100 2 , and 7 16 = 0111 2 Therefore: 0.C7 16 = 0.11000111 2

Hexadecimal - Decimal Conversion of Fraction

ex. 0.18E 16 = (?) 10 0.18E 16 = 1x

    • 8x

      + 14x - 

= 0.0625 + 0.03125 + 0. = 0.09692 10 Therefore: 0.18E 16 = 0.09692 10

Hexadecimal - Octal Conversion of Fraction

ex. 0.D3F 16 = (?) 8 since, D 16 = 1101 2 , 3 16 = 0011 2 , and F 16 = 1111 2 so, 0.D3F 16 = 0.110100111111 2 grouping the bits into threes: (starting from the binary point) 110 100 111 111 6 4 7 7

Therefore: 0.D3F 16 = 0.6477 8