1
Number Systems
Number system – a system of base or radix, r, is a system that uses
distinct symbols for r digits.
Number or
Nr digit symbol
Base or radix
Base or radix – number of digits which can occur in the number system
Examples:
Base 10 (10 digits) Base 16 (16 digits)
Can you name more?
Base 8 (8 digits) Base 2 (2 digits)
2
Number Systems
Example:
In decimal: (435.301)10
3
Number Systems
Base 16 – Hexadecimal number
used for addressing in microprocessors and to express binary numbers
Decimal point
Digits 6 5 4 5 2
(110.10)2
Binary point
The least significant bit (LSB) is the rightmost Weights 22 21 20 2-1 2-2
binary digit which has the lowest binary weight of
a given number. Digits 1 1 0 1 0
The most significant bit (MSB) is the leftmost
binary digit which has the highest binary weight MSB LSB MSB LSB
of a given number.
6
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.
7
Decimal to Binary Conversion
2 methods of converting a decimal number to binary:
1. Sum of weights
2. Repeated division by two.
Repeated multiplication by 2
3. The first carry produced is the MSB, and the last carry is the LSB. 10
Decimal fractions to Binary
14
11
Binary Arithmetic - Addition
CARRY: C3 C2 C1 C0
Word A: A3 A2 A1 A0
Addition of two 4-bit words A and B
Word B: B3 B2 B1 B0
SUM: S3 S2 S1 S0
The four basic rules for adding binary Example of binary addition:
digits (bits) are as follows:
Decimal Binary
Addition Rules 5 101
A+B Sum Carry +3 +011
0+0 0 0 8 1000
0+1 1 0
Try: (158)10 + (12)10
1+0 1 0
(111)2 + (1011)2
1+1 0 1 (1010)2 + (1010)2 12
( 23)10 + ( 15)10
Binary Arithmetic - Subtraction
Two efficient methods that can be implemented with hardware are:
1. Subtraction using 1’s complement.
2. Subtraction using 2’s complement.
Complements are used in digital computers for simplifying the subtraction operation
and for logical manipulation.
1 0 1 1 0 1 0 1
Obtain the 1’s complement of
(11010110)2 and (654)10 13
0 1 0 0 1 0 1 0
Binary Arithmetic - Subtraction
2’s complement of binary numbers
The 2's complement of a binary number is found by adding 1 to the LSB of the
1's complement.
14
Binary Arithmetic - Subtraction
3. If M < N, the sum does not produce an end carry the result is equal to the
2’s complement of (N - M). To obtain the correct answer, take the 2's
complement of the sum and place a negative sign in front.
15
Binary Arithmetic - Subtraction
Given two binary numbers X = 1010100 and Y = 1000011, perform the
subtractions: X – Y and Y – X using 2’s complements.
16
Hexadecimal Numbers
The hexadecimal number system
1. Has a base of sixteen; that is, it is composed of 16 numeric and
alphabetic characters: 0,1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
2. Has weights based on powers of 16
3. The position of a character in the number indicates its weight or value
within the number
Hexadecimal point
17
Hexadecimal Numbers
Decimal Binary Hexadecimal
0 0000 0
1 0001 1
2 0010 2
3 0011 3 Each 4-bit binary number
4 0100 4 can be represented by a
5 0101 5 hexadecimal number.
6 0110 6 Ex.
7 0111 7
(0000)2 – (0)16
8 1000 8
9 1001 9 (1100)2 - CH
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
18
15 1111 F
Hexadecimal to Binary
Converting Hexadecimal to Binary
Examples
A 3 16 = (1010 0011) 2
(37.12) 16 = (00110111.00010010) 2
Break the binary digits into groups of four starting from the binary point and
convert each group into its appropriate hexadecimal digit using the
conversion table.
For whole numbers, it may be necessary to add a zero as the MSB in order to
complete a grouping of four bits.
Example:
(101001)2 => (00101001)2 => 29H
(110 1100 1111)2 => (0110 1100 1111)2 => 6CFH
Hexadecimal point
Break the binary digits into groups of three starting from the binary point and
convert each group into its appropriate octal digit.
For whole numbers, it may be necessary to add a zero as the MSB in order
to complete a grouping of three bits.
Note that this does not change the value of the binary number.
010 = 2 (MSB)
Answer: (159.0625)10
(359) 10 = (547) 8
27