0% found this document useful (0 votes)
96 views

1numbering Systems

The document discusses various numbering systems including decimal, binary, octal, and hexadecimal. It provides examples of converting between these systems. Binary numbers are grouped into 3s or 4s to convert to octal or hexadecimal. The binary point is treated left to right after and right to left before conversion. Negative binary numbers use a leading 1 bit for the sign. Exercises at the end provide examples of converting decimal numbers to binary and between hexadecimal, octal, and binary.

Uploaded by

sirclav2276
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views

1numbering Systems

The document discusses various numbering systems including decimal, binary, octal, and hexadecimal. It provides examples of converting between these systems. Binary numbers are grouped into 3s or 4s to convert to octal or hexadecimal. The binary point is treated left to right after and right to left before conversion. Negative binary numbers use a leading 1 bit for the sign. Exercises at the end provide examples of converting decimal numbers to binary and between hexadecimal, octal, and binary.

Uploaded by

sirclav2276
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Numbering Systems

Base or Radix 10 numbering system


• also known as the decimal numbering system
• uses ten symbols: digits 0,1,2,3 up to 9

Binary numbering system


• uses binary digit (0 and 1) commonly called a bit -- the bits correspond to the off and
on positions of the switches in the computer

Place Value

• the position of the digit with respect to the decimal point (radix point)

Example: 762.8510

right-most digit (5)


• represents the least value
• called the least significant digit

left-most digit (7)


• represents the highest value
• called the most significant digit
Binary Number Systems

Example: 1101.112
Example 1.1

Convert the binary number 10101.012 to decimal

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.

POSITION POWER 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
DECIMAL EQUIVALENT 16 0 4 0 1 . 0 1

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

Step 3: Multiply .25 by 2.


Step 4: Multiply the fractional part again by 2.
N/2 INTEGER PART FRACTIONAL PART
0.25 * 2 = 0.5 0 .5
0.5 * 2 = 1 1 0

from top to bottom of the integer part, you get the answer, .012

Final Answer: 21.2510 = 10101.012

Example 1.2
Find the binary equivalent of 697.7812510.

Solution: Separate the integer from the fractional part.

For the integer number 697:


Step 1: 697 / 2 = 348 remainder 1 Answer: ? ? ? ? ? ? ? ? ? 1
Step 2: 348 / 2 = 174 remainder 0 Answer: ? ? ? ? ? ? ? ? 0 1
Step 3: 174 / 2 = 87 remainder 0 Answer: ? ? ? ? ? ? ? 0 0 1
Step 4: 87 / 2 = 43 remainder 1 Answer: ? ? ? ? ? ? 1 0 0 1
Step 5: 43 / 2 = 21 remainder 1 Answer: ? ? ? ? ? 1 1 0 0 1
Step 6: 21 / 2 = 10 remainder 1 Answer: ? ? ? ? 1 1 1 0 0 1
Step 7: 10 / 2 = 5 remainder 0 Answer: ? ? ? 0 1 1 1 0 0 1
Step 8: 5 / 2 = 2 remainder 1 Answer: ? ? 1 0 1 1 1 0 0 1
Step 9: 2 / 2 = 1 remainder 0 Answer: ? 0 1 0 1 1 1 0 0 1
Step 10: 1 / 2 = 0 remainder 1 Answer: 1 0 1 0 1 1 1 0 0 1

69710 = 10101110012

For the fractional part 0.7812510:


Step 11: 0.78125 * 2 = 1.5625 Answer: 0 . 1 ? ? ? ?
Step 12: 0.5625 * 2 = 1.125 Answer: 0 . 1 1 ? ? ?
Step 13: 0.125 * 2 = 0.25 Answer: 0 . 1 1 0 ? ?
Step 14: 0.25 * 2 = 0.5 Answer: 0 . 1 1 0 0 ?
Octal and Hexadecimal Numbering System

Octal Numbering System


• uses 0, 1, 2, 3, 4, 5, 6, 7 digits

Example: Breakdown the octal number 137.4


64S EIGHTS ONES 1/8THS
82 81 80 8-1
1 3 7 . 4

137.48 = 1*82 + 3*81 + 7*80 + 4*8-1


= 1*64 + 3*8 + 7*1 + 4*(1/8)
= 64 + 24 + 7 + 0.5
= 95.510

Hexadecimal Numbering System


• uses the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 digits and the letters A, B, C, D, E, and F to
supplement for the values of 10 to 15

Example: Breakdown the hexadecimal number B65F.E


4096S 256S 16S ONES 1/16S
3 2 1 0
16 16 16 16 16-1
11 6 5 15 . 14

B65F.E16 = 11*163 + 6*162 + 5*161 + 15*160 + 14*16-1


= 11*4096 + 6*256 + 5*16 + 15*1 + 14*(1/16)
= 45056 + 1536 + 80 + 15 + 0.875
= 46687.87510
Conversion of Binary Numerals into Octal
• binary digits are grouped into 3’s, right to left before the binary point, left to right after
the binary point

Binary to Octal Number Conversion Table


GROUP OF
111 110 101 100 011 010 001 000
BINARY DIGITS
OCTAL DIGIT 7 6 5 4 3 2 1 0

Padding the number with 0:


• add 0’s to the left of the most significant bit
• add 0’s to the right of the least significant bit

0101011.1101
000 101 011 . 110 100

Example: Convert the binary number 101011.11012 to octal number.

Step 1: Divide the binary number into groups of 3.


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

101 = 1*22 + 0*21 + 1*20 011 = 0*22 + 1*21 + 1*20


= 1*4 + 0*2 + 1*1 = 0*4 + 1*2 + 1*1
=4+0+1 =0+2+1
=5 =3

101 011 . 110 100

110 = 1*22 + 0*21 + 0*20 100 = 1*22 + 0*21 + 0*20


= 1*4 + 1*2 + 0*1 = 1*4 + 0*2 + 0*1
=4+2+0 =4+0+0
=6 =4

Final Answer: 101011.11012 = 53.648


Conversion of Binary Numerals into Hexadecimal
 binary digits are grouped into 4’s, right to left before the binary point, left to right after
the binary point
 the rules for adding 0’s remain the same

Binary to Hexadecimal Number Conversion Table


GROUP OF BINARY DIGITS HEXADECIMAL DIGIT
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F

Conversion of Hexadecimal Numerals into Octal

Example: Convert the binary number 101011.11012 to hexadecimal number.

Step 1: Divide the binary number into groups of 4.


0010 1011 . 1101

Step 2: Multiply each binary number to its place value and add the products to get the
hexadecimal digit.

0010 1011 . 1101

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

1101 = 1*23 + 1*22 + 0*21 + 1*20


= 1*8 + 1*4 + 0*2 + 1*1
=8+4+0+1
= 13 = D

Final Answer: 101011.11012 = 2B.D16

Exercises: Convert the following numbers to its binary equivalent:


1. 5.58
2. FACE16
3. 86416
4. 7001.68
5. 25.716

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

Decimal Binary Signed Binary


510 1012 01012
- 110 12 112

Example 1.4 Convert the following decimal numbers:


a. 1910
b. 7.510
c. 52110
d. 1010
e. -5.510
Decimal Binary Signed Binary Negative
1910 10011 101.1 110011
7.510 111.1 0111.1 1111.1
52110 1000001001 01000001001 11000001001
Diminished 1010 1010 01010 11010 Radix
Complement -5.510 101.1 1101.1 0101.1

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

Example. Consider finding the (r - 1)’s complement of the following numbers if n = 6.


a. 567894
b. 012598

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

• for values of N not 0:

r’s complement = (r - 1)’s complement +1 since rn - N = (rn - 1) - N + 1

Example. Find the r’s complement of the decimal number 567894.


10’s complement:
6
(10 - 1) - 567894 + 1 = 432106
Radix Complement of Binary Numbers

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.

Decimal Binary 16-Bit Encoding 2’s Complement


5.510 101.12 0000 0000 0101.10002 1111 1111 1011.10002

Binary Representation of Negative Numbers


Decimal 5-Bit Encoding 1’s Complement 2’s Complement
- 110 100012 111102 111112
-210 100102 111012 111102
-310 100112 111002 111012
: : : :
: : : :
-1310 111012 100102 100112
-1410 111102 100012 100102
-1510 111112 100002 100012
Binary Codes
• may represent the numbers, letters, symbols, or any information or characters

Example. How can we represent the person’s gender through binary numbers?

Solution: 2n > = number of information to be represented


where n = the number of binary digits required to represent the information
n=1
= 2n > = 21 = 2 number of information that can be represented

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

Binary Code Grade Level


000 1
001 2
010 3
011 4
100 5
101 6

Example. Represent the color of one’s hair through binary numbers.

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

Example. Find the BCD equivalent of the number 165.510.

1 = 0001 6 = 0110 5 = 0101

BCD equivalent = 000101100101.01012


ASCII
• American Standard Code for Information Interchange
• uses 7 bits to represent the text data
• has 128 combinations or 128 values which includes 94 printable characters:
• 26 uppercase letters
• 26 lowercase letters
• 10 decimal digits/numbers
• 32 special printable characters like @, *, &, etc.
• 34 special non-printable characters called control characters

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)

Abbreviations used in ASCII Table


ENQ – enquiry DLE – data link escape

ACK – acknowledge DC1 – device control 1

BEL – bell DC2 – device control 2

BS – backspace DC3 – device control 3

HT – horizontal tab DC4 – device control 4

NL – new line SYN – synchronous

VT – vertical tab ETB – end of transmission block

FF – form feed CAN – cancel

CR – carriage return SUB – substitute

SO – shift-out ESC – escape

SI – shift-in FS – field separator

NULL – null GS – group separator

SOH – start of heading RS – record separator

STX – start of text US – unit separator

ETX – end of text SP – space

EOT – end of transmission DEL – delete


Binary Addition

Binary Addition Rules


0+0=0 0+1=1 1+0=1 1 + 1 = 10

Example. Add the binary numbers 1.1, 011.1, and 101.1.

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

Binary Subtraction Rules


0-0=0 1-0=1 1-1=0 10 - 1 = 1

Example. Subtract the binary number 1011.1 from 10010.

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 3: Perform rules 1 to 3 since you have already borrowed from 1.


10
10010.0
- 1011.1
0.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

Step 5: Perform rules 1 to 3 until you arrive at the leftmost column.


1 1
0 10 10 10
1 0 0 1 0.0
- 1 0 1 1.1
00 1 1 0.1
Binary Multiplication
Nx1=N Nx0=0

Example. Multiply 1101 and 1011.01.

Solution:
Step 1: Align the multiplicand with the multiplier.
1 1 0 1. 0 0
x 1 0 1 1. 0 1

Step 2: Remember the two equations in performing binary multiplication.


Nx1=N Nx0=0

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

Example. Divide 101101 by 101.

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

You might also like