You are on page 1of 100

AbbySerenio

What is a number system?


What are the Different Positional Number
System? Define each, and give the example.

Number System 2
 A computer is a digital system that stores and processes
different types of data in the form of 0s and 1s.

 The different types of data handled by a computer system


include numbers, alphabets and some special characters.

 Therefore, there is a need to change the data entered by the


users into a form that the computer system can understand
and process.
 Different types of codes have been developed and used to
represent the data entered by the users in the binary format.
 The binary system represents each type of data in terms of
binary digits, 0s and 1s.
 Since these codes convert the data into the binary form, the
computer codes are also referred as binary codes.
 Computer professionals use different number systems
according to their requirements to communicate with the
computer system.

 All the number systems used by computer professionals to


interact with computer systems come under the category of
positional number system.

 The positional number system is a number system in which


numbers are represented using some symbols called digits
and the values of these numbers can be determined by
taking the position of digits into consideration.
The different positional number systems are:

 Decimal system
 Binary system
 Hexadecimal system
 Octal system
 The number system that we now use has
provided mathematicians, engineers and
scientist with a great advantage over those
of previous civilization. It has proven to be
an important factor in the rapid
advancement of modern science and
technology.

Number System 7
 The Decimal System for accounting 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 symbol
are called the Arabic numerals.

Number System 8
 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.

Number System 9
 Digital age and information age
 Digital computers
 General purposes
 Many scientific, industrial and commercial applications
 Digital systems
 Telephone switching exchanges
 Digital camera
 Electronic calculators, PDA's
 Digital TV
 Discrete information-processing systems
 Manipulate discrete elements of information
 For example, {1, 2, 3, …} and {A, B, C, …}…

Number System 10
 Base (also called radix) = 10
 10 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } 2 1 0 -1 -2
 Digit Position
5 1 2 7 4
 Integer & fraction
 Digit Weight 100 10 1 0.1 0.01
Position
 Weight = (Base)
 Magnitude 500 10 2 0.7 0.04
 Sum of “Digit x Weight”
d2*B2+d1*B1+d0*B0+d-1*B-1+d-2*B-2
 Formal Notation
(512.74)10
Number System 11
 Base = 8
 8 digits { 0, 1, 2, 3, 4, 5, 6, 7 } 64 8 1 1/8 1/64
 Weights 5 1 2 7 4
Position
 Weight = (Base) 2 1 0 -1 -2
 Magnitude 5
2 *8 2
+1 *8 1
+2 *8 0
+7 *8 -1
+4 *8 -

 Sum of “Digit x Weight”


=(330.9375)10
 Formal Notation (512.74)8

Number System 12
 Base = 2
 2 digits { 0, 1 }, called binary digits4or “bits”
2 1 1/2 1/4
 Weights 1 0 1 0 1
Position
 Weight = (Base) 2 1 0 -1 -2
 Magnitude 1
2 *2 2
+0 *2 1
+1 *2 0
+0 *2 -1
+1 *2 -

 Sum of “Bit x Weight”


=(5.25)10
 Formal Notation
(101.01)2
 Groups of bits 4 bits = Nibble
1011
8 bits = Byte
11000101
Number System 13
 Base = 16
 16 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }
 Weights 256 16 1 1/16 1/256
Position
 Weight = (Base) 1 E 5 7 A
 Magnitude 2 1 0 -1 -2

1 *162+14 *161+5 *160+7 *16-1+10 *16-2


 Sum of “Digit x Weight”
 Formal Notation =(485.4765625)10

(1E5.7A)16

Number System 14
n 2n n 2n
0 20=1 8 28=256
1 21=2 9 29=512
Kilo
2 22=4 10 210=1024
3 23=8 11 211=2048
4 24=16 12 212=4096
20 220=1M Mega
5 25=32
6 26=64 30 230=1G Giga

7 27=128 40 240=1T Tera

Number System 15
 Decimal Addition
1 1 Carry
5 5
+ 5 5

1 1 0
= Ten ≥ Base
 Subtract a Base

Number System 16
 Column Addition

1 1 1 1 1 1
1 1 1 1 0 1 = 61
+ 1 0 1 1 1 = 23

1 0 1 0 1 0 0 = 84

≥ (2)10
 Borrow a “Base” when needed
1 2 = (10)2
0 2 2 0 0 2
1 0 0 1 1 0 1 = 77
− 1 0 1 1 1 = 23

0 1 1 0 1 1 0 = 54
 Bit by bit
1 0 1 1 1
x 1 0 1 0
0 0 0 0 0
1 0 1 1 1
0 0 0 0 0
1 0 1 1 1

1 1 1 0 0 1 1 0
Number System 20
Used by Used in
System Base Symbols humans? computers?
Decimal 10 0, 1, … 9 Yes No
Binary 2 0, 1 No Yes
Octal 8 0, 1, … 7 No No
Hexa- 16 0, 1, … 9, No No
decimal A, B, … F

Number System 21
Hexa-
Decimal Binary Octal decimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
Number System 22
Hexa-
Decimal Binary Octal decimal
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
Number System 23
Hexa-
Decimal Binary Octal decimal
16 10000 20 10
17 10001 21 11
18 10010 22 12
19 10011 23 13
20 10100 24 14
21 10101 25 15
22 10110 26 16 Etc.
23 10111 27 17
Number System 24
Evaluate
Magnitude
Octal
(Base 8)

Evaluate
Magnitude
Decimal Binary
(Base 10) (Base 2)

Hexadecimal
(Base 16)
Evaluate
Magnitude
 The possibilities:
Decimal Octal

Binary Hexadecimal

Number System 26
2510 = 110012 = 318 = 1916

Base

Number System 27
Decimal Octal

Binary Hexadecimal

Next slide…

Number System 28
Weight

12510 => 5 x 100 = 5


2 x 101 = 20
1 x 102 = 100
125

Base

Number System 29
Decimal Octal

Binary Hexadecimal

Number System 30
 Technique
 Multiply each bit by 2n, where n is the “weight” of
the bit
 The weight is the position of the bit, starting from
0 on the right
 Add the results

Number System 31
Bit “0”

1010112 => 1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
4310

Number System 32
Decimal Octal

Binary Hexadecimal

Number System 33
 Technique
 Multiply each bit by 8n, where n is the “weight” of
the bit
 The weight is the position of the bit, starting from
0 on the right
 Add the results

Number System 34
7248 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
46810

Number System 35
Decimal Octal

Binary Hexadecimal

Number System 36
 Technique
 Multiply each bit by 16n, where n is the “weight” of
the bit
 The weight is the position of the bit, starting from
0 on the right
 Add the results

Number System 37
ABC16 => C x 160 = 12 x 1 = 12
B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
274810

Number System 38
Decimal Octal

Binary Hexadecimal

Number System 39
 Technique
 Divide by two, keep track of the remainder
 First remainder is bit 0 (LSB, least-significant bit)
 Second remainder is bit 1
 Etc.

Number System 40
 Divide the number by the ‘Base’ (=2)
 Take the remainder (either 0 or 1) as a
coefficient
 Take the quotient and repeat the division
Example: (13)10
Quotient Remainder Coefficient
13/ 2 = 6 1 a0 = 1
6 /2= 3 0 a1 = 0
3 /2= 1 1 a2 = 1
1 /2= 0 1 a3 = 1
Answer: (13)10 = (a3 a2 a1 a0)2 = (1101)2

MSB LSB
12510 = ?2 2 125
2 62 1
2 31 0
2 15 1
2 7 1
2 3 1
2 1 1
0 1

12510 = 11111012

Number System 42
Decimal Octal

Binary Hexadecimal

Number System 43
 Technique
 Convert each octal digit to a 3-bit equivalent
binary representation

Number System 44
7058 = ?2

7 0 5

111 000 101

7058 = 1110001012

Number System 45
Decimal Octal

Binary Hexadecimal

Number System 46
 Technique
 Convert each hexadecimal digit to a 4-bit
equivalent binary representation

Number System 47
10AF16 = ?2

1 0 A F

0001 0000 1010 1111

10AF16 = 00010000101011112

Number System 48
Decimal Octal

Binary Hexadecimal

Number System 49
 Technique
 Divide by 8
 Keep track of the remainder

Number System 50
Example: (175)10
Quotient Remainder Coefficient
175 / 8 = 21 7 a0 = 7
21 / 8 = 2 5 a1 = 5
2 /8= 0 2 a2 = 2
Answer: (175)10 = (a2 a1 a0)8 = (257)8

Example: (0.3125)10
Integer Fraction Coefficient
0.3125 * 8 = 2 . 5 a-1 = 2
0.5 *8= 4 . 0 a-2 = 4
Answer: (0.3125)10 = (0.a-1 a-2 a-3)8 = (0.24)8
123410 = ?8

8 1234
8 154 2
8 19 2
8 2 3
0 2

123410 = 23228

Number System 52
Decimal Octal

Binary Hexadecimal

Number System 53
 Technique
 Divide by 16
 Keep track of the remainder

Number System 54
123410 = ?16

16 1234
16 77 2
16 4 13 = D
0 4

123410 = 4D216

Number System 55
Decimal Octal

Binary Hexadecimal

Number System 56
Octal Binary
 8 = 23 0 000
 Each group of 3 bits 1 001
represents an octal digit 2 010
Assume Zeros
Example: 3 011

( 1 0 1 1 0 . 0 1 )2 4 100
5 101
6 110
( 2 6 . 2 )8 7 111

Works both ways (Binary to Octal & Octal to Binary)


10110101112 = ?8

1 011 010 111

1 3 2 7

10110101112 = 13278

Number System 58
Decimal Octal

Binary Hexadecimal

Number System 59
 Technique
 Group bits in fours, starting on right
 Convert to hexadecimal digits

Number System 60
Hex Binary
 16 = 24 0
1
0000
0001
 Each group of 4 bits 2
3
0010
0011
represents a hexadecimal 4 0100
5 0101
digit Assume Zeros 6 0110
Example: 7 0111
8 1000
( 1 0 1 1 0 . 0 1 )2 9 1001
A 1010
B 1011
C 1100
D 1101
(1 6 . 4 )16 E 1110
F 1111

Works both ways (Binary to Hex & Hex to Binary)


10101110112 = ?16

10 1011 1011

2 B B

10101110112 = 2BB16

Number System 62
Decimal Octal

Binary Hexadecimal

Number System 63
 Technique
 Use binary as an intermediary

Number System 64
 Convert to Binary as an intermediate step
Example:
( 2 6 . 2 )8

Assume Zeros Assume Zeros

( 0 1 0 1 1 0 . 0 1 0 )2

(1 6 . 4 )16

Works both ways (Octal to Hex & Hex to Octal)


10768 = ?16

1 0 7 6

001 000 111 110

2 3 E

10768 = 23E16

Number System 66
Decimal Octal

Binary Hexadecimal

Number System 67
 Technique
 Use binary as an intermediary

Number System 68
1F0C16 = ?8

1 F 0 C

0001 1111 0000 1100

1 7 4 1 4

1F0C16 = 174148

Number System 69
 Base 10 Power Preface Symbol Value
10-12 pico p .000000000001

10-9 nano n .000000001

10-6 micro  .000001

10-3 milli m .001

103 kilo k 1000

106 mega M 1000000

109 giga G 1000000000


1012 tera T 1000000000000

Number System 70
 Base 2 Power Preface Symbol Value
210 kilo k 1024

220 mega M 1048576

230 Giga G 1073741824

• What is the value of “k”, “M”, and “G”?


• In computing, particularly w.r.t. memory,
the base-2 interpretation generally applies

Number System 71
In the lab…
1. Double click on My Computer
2. Right click on C:
3. Click on Properties

/ 230 =

Number System 72
 Determine the “free space” on all drives on a
machine in the lab
Free space
Drive Bytes GB
A:
C:
D:
E:
etc.

Number System 73
 Number point or radix point
Decimal point in base 10
Binary point in base 2
 No exact relationship between fractional
numbers in different number bases
Exact conversion may be impossible

74
 Decimal number Base or radix
… a5a4a3a2a1.a1a2a3… aj
Decimal point Power
  105 a5  104 a4  103 a3  102 a2  101 a1  100 a0  101 a1  102 a2  103 a3  

Example:
7,329  7 103  3 102  2 101  9 100

• General form of base-r system


an  r n  an1  r n1    a2  r 2  a1  r1  a0  a1  r 1  a2  r 2    am  r m

Coefficient: aj = 0 to r  1
Example: Base-2 number
(11010.11)2  (26.75)10
 1  24  1  23  0  22  1  21  0  20  1  21  1  22

Example: Base-8 number


(127.4)8
 1  83  2  82  1  81  7  80  4  81  (87.5)10

Example: Base-16 number


(B65F)16  11 163  6 162  5 161  15 160  (46,687)10
 Examples:
 Convert the decimal number (12.0625)10 into binary number.
Solution:
Fractional part:
0.0625 x 2 = 0.1250 0
0.1250 x 2 = 0.2500 0
0.2500 x 2 = 0.500 0
0.500 x 2 = 1.000 1

(12.0625)10 = (1100.0001)2
.14579
x 2
 Decimal
3.14579
to binary 0.29158
x 2
0.58316
x 2
1.16632
x 2
0.33264
x 2
0.66528
x 2
1.33056
11.001001... etc.

p. 50

Number System 79
 Examples:
 Convert the decimal number (225.225)10 into octal number.
Solution:
Fractional part:
0.225 x 8 = 1.800 1
0.800 x 8 = 6.400 6
0.400 x 8 = 3.200 3
0.200 x 8 = 1.600 1
0.600 x 8 = 4.800 4

(225.225)10 = (341.16314)8
 Examples:
 Convert the decimal number (225.225)10 into hexadecimal
number.
Solution:
Fractional part:
0.225 x 16 = 3.600 3
0.600 x 16 = 9.600 9

(225.225)10 = (E1.39)16
 Conversion from binary to octal can be done by positioning the binary number into
groups of three digits each, starting from the binary point and proceeding to the left
and to the right.
(10 110 001 101 011 . 111 100 000 110) 2 = (26153.7406)8
2 6 1 5 3 7 4 0 6
 Conversion from binary to hexadecimal is similar, except that the binary number is divided into
groups of four digits:

 Conversion from octal or hexadecimal to binary is done by reversing the preceding


procedure.
Show your Solution

1) 28.55510 = ________________________________2
2) 101.0101112 = ________________________10

Number System 83
 For common bases, add powers
ab  ac = ab+c

26  210 = 216 = 65,536


or…
26  210 = 64  210 = 64k

Number System 84
 Two 1-bit values
A B A+B
0 0 0
0 1 1
1 0 1
1 1 10
“two”

pp. 36-38

Number System 85
 Two n-bit values
 Add individual bits
 Propagate carries
 E.g.,
1 1
10101 21
+ 11001 + 25
101110 46

Number System 86
 Decimal (just for fun)
35
x 105
175
000
35
3675

pp. 39

Number System 87
 Binary, two 1-bit values
A B A B
0 0 0
0 1 0
1 0 0
1 1 1

Number System 88
 Binary, two n-bit values
 As with decimal values
 E.g., 1110
x 1011
1110
1110
0000
1110
10011010

Number System 89
1. 111 5. 10101
x 101 x 111
---------- ---------------
2. 11.00 6. 100011
x 10.10 x 1100011
------------- ------------------
3. 101
x 11
---------------
4. 1011
x 1001
---------------

Number System 90
 Binary numbers can also be negative, just like decimal numbers. If a
larger number is subtracted from a smaller number, the negative
sign is prefixed in the answer.

A B A–B
0 0 0
1 0 1
1 1 0
“w/ a
0 1 0 borrow of
1”

Number System 91
The following examples:
Binary Decimal
1010 10
- 100 - 4
110 6

100011 35
- 1111 - 15
10100 20

1000.11 8.75
- 11.01 - 3.25
101.10 5.50

Number System 92
1. 1011011 4. 100010110
- 10010 - 1111010
----------------- --------------------
2. 1010110 5. 101101
- 101010 - 100111
----------------- --------------------
3. 1000101 6. 1110110
- 101100 - 1010111
--------------- --------------------

Number System 93
 Binary division is a very simple process. Division is defined as the
process of determining how many times one number, the divisor,
can be subtracted from another number, the dividend, while still
leaving a position remainder. The number of times this can be done
is the result, or quotient.

A B A/ B
0 0 0
0 1 0
1 1 1

Number System 94
11
12/4=3
100 1100
100
100
100
------
0

Number System 95
Number System 96
1. 100 / 10 =
2. 111 / 11 =
3. 1010 / 100 =
4. 1101 / 11 =
5. 10111 / 10 =

Number System 97
 Decimal to decimal (just for fun)

3.14 => 4 x 10-2 = 0.04


1 x 10-1 = 0.1
3 x 100 = 3
3.14

pp. 46-50

Number System 98
 Binary to decimal
10.1011 => 1 x 2-4 = 0.0625
1 x 2-3 = 0.125
0 x 2-2 = 0.0
1 x 2-1 = 0.5
0 x 20 = 0.0
1 x 21 = 2.0
2.6875

pp. 46-50

Number System 99
.14579
x 2
 Decimal
3.14579
to binary 0.29158
x 2
0.58316
x 2
1.16632
x 2
0.33264
x 2
0.66528
x 2
1.33056
11.001001... etc.

p. 50

Number System 100


Next topic

Number System 101

You might also like