1numbering Systems
1numbering Systems
Place Value
• the position of the digit with respect to the decimal point (radix point)
Example: 762.8510
Example: 1101.112
Example 1.1
Solution:
Step 1: Make a listing of the position values above each digit.
POWER
POSITION
OF 2 24 23 22 21 20 2-1 2-2
VALUE
DECIMAL 16 8 4 2 1 0.5 0.25
BINARY DIGITS 1 0 1 0 1 . 0 1
Step 2: For each column, multiply the position value of the column by the digit contained in
that column.
Step 3: Add the values listed in the decimal equivalent row to get the decimal answer.
10101.012 = 16 + 0 + 4 + 0 + 1 + 0.25 = 21.2510
Convert the decimal number 21.2510 to binary.
Step 1: Separate the integer part from the fractional part then; convert the decimal number
2110.
Step 2: Divide the integer 21 by 2 to get the quotient 10 and the remainder 1.
from bottom to top of the remainders, you get the answer, 101012
from top to bottom of the integer part, you get the answer, .012
Example 1.2
Find the binary equivalent of 697.7812510.
69710 = 10101110012
0101011.1101
000 101 011 . 110 100
Step 2: Multiply each binary number to its place value and add the products to get the octal
digit.
101 011 . 110 100
Step 2: Multiply each binary number to its place value and add the products to get the
hexadecimal digit.
0010 = 0*23 + 0*22 + 1*21 + 0*20 1011 = 1*23 + 0*22 + 1*21 + 1*20
= 0*8 + 0*4 + 1*2 + 0*1 = 1*8 + 0*4 + 1*2 + 1*1
=0+0+2+0 =8+0+2+1
=2 = 11 = B
0010 1011 . 1101
Solution:
1. 5.58 5 = 1012
5.58 = 101.1012
2. FACE16 F = 11112
A = 10102
C = 11002
E = 11102
FACE16 = 1111 1010 1100 11102
3. 86416 8 = 10002
6 = 01102
4 = 01002
86416 = 1000 0110 01002
4. 7001.68 7 = 1112
0 = 0002
1 = 0012
6 = 1102
7001.68 = 111 000 001 1102
5. 25.716 2 = 00102
5 = 01012
7 = 01112
25.716 = 00101.01112
(the two 0’s at the beginning was disregarded)
Negative Numbers
Signed Magnitude Representation
• padding the binary number with a sign bit at the beginning to indicate its sign
• 0 - added at the start to indicate a positive number
• 1 - stands for a negative number
Complements
• used in digital computers for simplifying the subtraction operation and for logical
operations
• diminished radix complement of a number N of base r and with n digits is defined as:
(r - 1)’s complement:
(rn - 1) – N
Solution:
Formula: (rn - 1) - N
Given: n = 6; r = 10
Then: 106 = 1,000,000
rn - 1 = 1,000,000 - 1 = 999,999
a. N = 567894
9’s complement:
(106 - 1) - 567894 = 432105
b. N = 012598
9’s complement:
(106 - 1) - 012598 = 987401
NOTE: The 9’s complement of the number can be more simply derived by subtracting each digit
of N from 9.
1’s complement:
(2n - 1) – N
Example 1.5
Find the 1’s complement of the following numbers:
a. 002
b. 01112
c. 01001000102
d. 1.10012 in an 8-bit computer
e. 1510 in a 6-bit calculator
Solution:
a. 002 = 112
b. 01112 = 10002
c. 01001000102 = 10110111012
d. 1.10012 = 01.10012 = 10.01102
e. 1510 = 0011112 = 1100002
Radix Complement
• radix complement of a number N of base r and with n digits is defined as r’s
complement:
rn - N, for N not 0
0, for N = 0
Step 1: Find the least significant 1 bit and let this be the anchor.
Step 2: Change each of the bits to the left of this anchor while the 1 itself (or LSB) and all other
bits in the less significant positions remain unchanged.
Step 3: The result is the 2’s complement.
Example 1.6 Find the 2’s complement of each of the following numbers:
a. 002
b. 011.12
c. 11001000102
d. 01000112
e. 5.510 on a Sony PlaystationTM
Solution:
a. 002 = 0(the special case N = 0)
b. 011.12 = 101.12
c. 11001000102 = 00110111102
d. 01000112 = 10111012
e. Convert the decimal number to binary and pad leading or trailing 0’s as necessary to get
the fixed 16-bit size.
Example. How can we represent the person’s gender through binary numbers?
Example. Represent a student’s grade level in elementary school through binary numbers.
Solution:
2n > = number of information to be represented
where n = 3
23 > = 8 = 6 number of information that can be represented
the following combinations can be used: 000, 001, 010, 011, 100, 110, and 111
Solution:
for 5 different colors of hair, choose n = 3 to satisfy the formula:
2n > = number of information to be represented
where n = 3
23 > = 8 = 6 number of information that can be represented
Binary Coded Decimal (BCD)
• the direct translation of the 10 decimal digits into its 4-bit binary counterparts
• a form of coding that which is numeric in nature since it encodes numeric characters
Decimal BCD
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
Control Characters
• correspond to those keys and/or commands that include formatting of data (e.g. BS for
Backspace), sending information (e.g. CR for Carriage Return or the Enter key)
Solution:
Step 1: Write the numbers aligning the radix point then start evaluating from the rightmost
column.
001.1
011.1
+ 101.1
Step 2: Cross out each pair of 1’s and generate a carry every time a pair is crossed out.
(1) - carry
001.1
011.1
+ 101.1
.1
Step 3: Two carries cannot be represented by the numeral 2. However, it can be represented as
shown below.
(1) - carry
(1) - carry
0 0 1.1
0 1 1.1
+1 0 1.1
0.1
Step 4: Continue evaluating until all the columns have been evaluated.
(1) - carry
0 0 1.1
0 1 1.1
+ 1 0 1.1
1 0.1
Step 5: The final carry can be immediately carried down as the most significant bit.
(1) - carry
0 0 1.1
0 1 1.1
+ 1 0 1.1
1 0 1 0.1
Binary Subtraction
Solution:
Step 1: Write the numbers aligning the radix point then start evaluating from the rightmost
column. Note: You need to borrow to evaluate the rightmost column.
10010.0
-1011.1
Step 2: If borrowing is required, borrow from the nearest 1 at the left digit. Add this to the next
digit to its right until we arrive at the column you are evaluating.
1
0 0 10 10
10010.0
-1011.1
Step 4: Perform borrowing from the nearest 1 at the left digit. Repeat Step 2.
1 1
0 10 10 10
1 0 0 1 0.0
- 1 0 1 1.1
0.1
Solution:
Step 1: Align the multiplicand with the multiplier.
1 1 0 1. 0 0
x 1 0 1 1. 0 1
Note that you are to align the product with the multiplier digit to which you are multiplying the
multiplicand.
1 1 0 1. 0 0
x 1 0 1 1. 0 1
1 1 0 1 0 0
0 0 0 0 0 0
1 1 0 1 0 0
1 1 0 1 0 0
0 0 0 0 0 0
1 1 0 1 0 0
Step 3: Add the resulting products as aligned above. The decimal point is placed on the fourth
place from the right.
1 1 0 1. 0 0
x 1 0 1 1. 0 1
1 1 0 1 0 0
0 0 0 0 0 0
1 1 0 1 0 0
1 1 0 1 0 0
0 0 0 0 0 0
1 1 0 1 0 0
1 0 0 1 0 0 1 0. 0 1 0 0
Example. Multiply 1011.1 and 1001.01.
Solution:
Step 1:
1 0 1 1. 1 0
x 1 0 0 1. 0 1
Step 2:
1 0 1 1. 1 0
x 1 0 0 1. 0 1
1 0 1 1 1 0
0 0 0 0 0 0
1 0 1 1 1 0
0 0 0 0 0 0
0 0 0 0 0 0
1 0 1 1 1 0
Step 3:
1 0 1 1. 1 0
x 1 0 0 1. 0 1
1 0 1 1 1 0
0 0 0 0 0 0
1 0 1 1 1 0
0 0 0 0 0 0
0 0 0 0 0 0
1 0 1 1 1 0
1 1 0 1 0 1 0. 0 1 1 0
Binary Division
Dividend
the number to be divided
Divisor
the quantity by which the dividend will be divided by
Quotient
the resulting quantity when the dividend has been divided by the divisor
Solution:
Step 1: Determine the number of digits (n) of the divisor.
101101 - dividend
101 - divisor
n=3
the first n digits of the dividend is equal to the divisor
1 0 1 1 0 1 1 0 1
Step 2: Write a 1 aligned with the resulting number’s place value. Subtract the divisor from the
corresponding number.
1
1 0 1 1 0 1 1 0 1
1 0 1
0 0 0
Step 3: Bring down the next bit from the dividend. NOTE: Place 0 if the divisor is > the dividend.
Place 1 if the divisor is < the dividend.
1 0
1 0 1 1 0 1 1 0 1
1 0 1
0 0 0 1 0
Step 4: Repeat step 3 until all the difference is 0 and/or the bits of the dividend has been
brought down.
1 0
1 0 1 1 0 1 1 0 1
1 0 1
0 0 0 1 0 1
1 0 1
0 0 0
Example. Divide 100101.1 by 111.
Solution:
Step 1: Determine the number of digits (n) of the divisor.
00101.1 - dividend
111 - divisor
n=3
the first n digits of the dividend (100) is < the divisor (111)
use n + 1 = 4 digits of the dividend, which is 1001
1 1 1 1 0 0 1 0 1 1
Step 2:
1
1 1 1 1 0 0 1 0 1 1
1 1 1
0 1 0
Step 3:
1
1 1 1 1 0 0 1 0 1 1
1 1 1
0 1 0 0 1
Step 4:
1 0 1. 0 1 0 1
1 1 1 1 0 0 1 0 1. 1 0 0 0
1 1 1
0 0 1 0 0 1
0 1 1 1
0 0 1 0 1 0
0 1 1 1
0 1 1 0 0
0 1 1 1
0 1 0 1