Академический Документы
Профессиональный Документы
Культура Документы
Objective
Introduction
Decimal Numbering System
Uses ten (10) as a base, also called base-
10 system.
It uses ten digit symbols: 0, 1, 2, 3, 4, 5,
6, 7, 8, and 9.
Each number position represents a
weighting factor (positional value system)
which is a power of the base ten. (1, 10,
100, 1000, etc.)
Why do we use 10 digits, anyway?
Digit is derived from the Latin word for
finger
Decimal: Example
4175.8610 can be computed as:
=(4 x 10
3
) + (1 * 10
2
) + (7 * 10
1
) + (5 * 10
0
)
+ (8 * 10
-1
) + (6 * 10
-2
)
7,392.42 is equal to:
= (7 * 10
3)
+ (3 * 10
2)
+ (9 * 10
1)
+ (2 * 10
0)
+
(4 * 10
-1)
+ (2 * 10
-2
)
Octal Numbering System
A base-eight numbering system with eight
digits of 0,1,2,3,4,5,6,7.
Decimal Octal
-------- ------
0 0
1 1
7 7
8 10
9 11
Octal (cont.)
For example to count in octal the digits
combine after reaching a count of 7
1,..7,10,11,12,,17,20,21,,75,76,77,100
For two octal digits the largest number is
77 so the two octal digits end after at 77.
Octal (cont.)
To find the decimal number equal to an
octal number:
(127.4)
8
= (1* 8
2)
+(2 * 8
1)
+ (7 * 8
0)
+
(4 * 8
-1
)
= (87.5)
10
(4536)
8
= (4x8
3)
+ (5x8
2) + (
3x8
1
)
+ (
6x8
0
)
= (1362)
10
Summary: Octal
In the octal system, a number with digits
XYZ can be written as:
XYZ
8
= (X x 8
2
) + (Y x 8
1
) + ( Z x 8
0
)
Sixty fours Eights Ones
32768 4096 512 64 8 1
. 8
5
8
4
8
3
8
2
8
1
8
0
Hexadecimal Numbering System
Has a base-16
There are 16 digits in this system: 0, 1..9, and A,
B, C, D, E, F)
Hexadecimal Decimal
----------- -------
0 0
1 1
..
9 9
A 10
B 11
..
E 14
F 15
Hexadecimal (cont.)
To count in hexadecimal:
0..F,10,11,19,1A,1B,..,1E,1F,20,
21,.99,9A,,9F,A0,A1..,FE,FF,100
For two hexadecimal digits the largest
number is FF so the two hexadecimal
digits end after at FF.
Hexadecimal (cont.)
To find the decimal number equal to a
hexadecimal number:
(B65F)
16
= (11 * 16
3
)+ (6 * 16
2
)+ (5 * 16
1
)+ (5 * 16
0
)
= (46,687)
10
Try this
(BCF)
16
(FA.CE)
16
Hexadecimal (cont.)
XYZ
16
= X x 16
2
+ Y x 16
1
+ Z x 16
0
256s 16s 1s
1048576 65536 4096 256 16 1
. 16
5
16
4
16
3
16
2
16
1
16
0
Binary Numbering System
Uses two (2) as a base, made of binary
digits (bits): 0 and 1; useful to represent
switch positions (open or closed).
Leftmost bit position is called Most
Significant Bit (MSB).
Right most bit position is called Least
Significant Bit (LSB).
Binary Numbering System
Groups of eight bits are called a byte
(11001001)
2
Groups of four bits are called a nibble.
(1101)
2
2
1
2
0
Base 10
Equivalent
0 0 0
0 1 1
1 0 2
1 1 3
Conversion of Integer from
Decimal to other Bases
For each digit position:
1. Divide decimal number by the base.
2. The remainder is the lowest-order digit
3. Repeat first two steps until no divisor
remains.
Example: (13)
10
= _____
2
Integer
Quotient
13/2 = 6 + a
0
= 1
6/2 = 3 + 0 a
1
= 0
3/2 = 1 + a
2
= 1
1/2 = 0 + a
3
= 1
Remainder Coefficient
Answer (13)
10
= (a
3
a
2
a
1
a
0
)
2
= (1101)
2
Integer Conversion:
Try This:
(53)
10
= _____ 2
(255)
10
= _____ 8
(2008)
10
= _____ 16
(100)
10
= _____ 4
(1024)
10
= _____ 12
Conversion of Fractions from
Decimal to other Bases
For each digit position:
1. Multiply decimal number by the base.
2. The integer is the highest-order digit
3. Repeat first two steps until fraction
becomes zero (or repeated/continuous).
Example: (0.625)
10
= ____
2
Integer
0.625 x 2 = 1 + 0.25 a
-1
= 1
0.250 x 2 = 0 + 0.50 a
-2
= 0
0.500 x 2 = 1 + 0 a
-3
= 1
Fraction
Coefficient
Answer (0.625)
10
= (0.a
-1
a
-2
a
-3
)
2
= (0.101)
2
Conversion
Try This
(0.8125)
10
= ______2
(0.3125)
10
= ______8
Hexadecimal to Binary Conversion
Converting from Hex to Binary is easy:
Every hex digit becomes 4 binary digits
Example #1: (1AF5)
16
=(0001 1010 1111 0101)
2
Example #2: (306.D)
16
= ( 0011 0000 0110. 1101 )
2
Binary to Hexadecimal Conversion
Just as simple, reverse to process
Example: (11100101010101.1101)
2
=(0011 1001 0101 0101 . 1101)
2
=(3955.D)
16
Octal to Binary
Converting from Octal to Binary is trivial:
Every octal digit becomes 3 binary digits
Example: (17.5 )
8
=(001 111 . 101)
2
Binary to Octal
Just as simple, reverse to process
Example: (11001010101.011101)
2
=(011 001 010 101 . 011 101)
2
=(3125.35)
8
Note: Using the hex and octal equivalent
instead of binary numbers are more
convenient and less prone to errors.
Exercises: