Number System
▪ Decimal number system
▪ Binary number system
▪ Hexadecimal number system
▪ Conversion of numbers
❑ Based on ‘Place values’
– Decimal system: based on powers of 10.
– Binary system: based powers of 2
– Octal system: based on powers of 8
– Hexadecimal system: based powers of 16
Some Numbers to Remember
Decimals Binary Octal Hexadecimal
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
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
Decimal (base 10)
• Each digit corresponds to a power of 10
based on its position in the number
• The powers of 10 increment from 0, 1, 2,
etc. as you move from right to left, for
example;
1479 = 1 x 103 + 4 x 102 + 7 x 101 + 9 x 100
Binary (base 2)
• Two digits: 0, 1
• To make the binary numbers more
readable, the digits are often put in
groups of 4, for eg
Bin1010 = 1 x 23 + 0 x 22 + 1 x 21 + 0 x 20
=8+2
= 10
Bin1100 1001 = 1 x 27 + 1 x 26 + 1 x 23 + 1 x 20
= 128 + 64 + 8 + 1
= 201
Hexadecimal (base 16)
• Shorter & easier to read than binary
numbers
• 16 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C,
D, E, F
Hex 123 = 1 x 162 + 2 x 161 + 3 x 160
= 1 x 256 + 2 x 16 + 3 x 1
= 256 + 32 + 3
= 291
Octal number system (Base 8 )
• Base 8 (octal number system)
• This number system consists of numbers
0,1,2,3,4,5,6,7.
Oct 123 = 1 x 82 + 2 x 81 + 3 x 160
= 1 x 64 + 2 x 8 + 3 x 1
= 64 + 16 + 3
= 83
Decimal to Binary Conversions
• Integers
– Division remainder method
– Proof (on pp. 9 of the text)
– Example 4
• Suppose we want to
convert the decimal
number 147 to base 2.
14710=100100112
❖ Binary-to-Hexadecimal Conversion
• Simply break the binary number into 4-bit groups, starting at the right-
most bit and replace each 4-bit group with the equivalent hexadecimal
symbol as in the following example.
• Convert the binary number to hexadecimal:
• 1100101001010111
• Solution:
• 1100 1010 0101 0111
•
• C A 5 7 = CA57
❖ Hexadecimal-to-Decimal Conversion
• One way to find the decimal equivalent of a hexadecimal number is to
first convert the hexadecimal number to binary and then convert from
binary to decimal.
• Convert the hexadecimal number 1C to decimal:
• 1 C
• 0001 1100 = 2 + 2³ + 2² = 16 +8+4 = 28
❖ Decimal-to-Hexadecimal Conversion
• Repeated division of a decimal number by 16 will produce the equivalent
hexadecimal number, formed by the remainders of the divisions. The
first remainder produced is the least significant digit (LSD). Each
successive division by 16 yields a remainder that becomes a digit in the
equivalent hexadecimal number. When a quotient has a fractional part,
the fractional part is multiplied by the divisor to get the remainder.
❖ Octal-to-Decimal Conversion
• Since the octal number system has a base of eight, each successive
digit position is an increasing power of eight, beginning in the right-most
column with 8º. The evaluation
• Of an octal number in terms of its decimal equivalent is accomplished by
multiplying each digit by its weight and summing the products.
• Let’s convert octal number 2374 in decimal number.
• Weight 8³ 8² 8 8º
• Octal number 2 3 7 4
• 2374 = (2 x 8³) + (3 x 8²) + (7 x 8) + (4 x 8º)=1276
❖ Octal-to-Binary Conversion
• Because each octal digit can be represented by a 3-bit binary
number, it is very easy to convert from octal to binary..
• Octal/Binary Conversion
• Octal Digit 0 1 2 3 4 5 6 7
• Binary 000 001 010 011 100 101 110 111
Let’s convert the octal numbers 25 and 140.
2 5 1 4 0
010 101 001 100 000
❖ Decimal-to-Octal Conversion
• A method of converting a decimal number to an octal number is
the repeated division-by-8 method, which is similar to the method
used in the conversion of decimal numbers to binary or to
hexadecimal.
• Let’s convert the decimal number 359 to octal. Each successive
division by 8 yields a remainder that becomes a digit in the
equivalent octal number. The first remainder generated is the least
significant digit (LSD).
• 359 = 44.875 0.875 x 8 = 7 (LSD)
• 8
• 44 = 5.5 0.5 x 8 = 4
❖ Binary-to-Octal Conversion
• Conversion of a binary number to an octal number is the reverse
of the octal-to-binary conversion.
• Let’s convert the following binary numbers to octal:
• 110101 101111001
• 6 5 = 65 5 7 1 = 571
❖ Binary-to-Decimal Conversion
• The decimal value of any binary number can be found by adding
the weights of all bits that are 1 and discarding the weights of all
bits that are 0.
• Example
• Let’s convert the binary whole number 101101 to decimal.
• Weight: 2 2 2 2 2 2º
• Binary no: 1 0 1 1 0 1
• 101101= 2 + 2 + 2 + 2º = 32+8+4+1=45