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

Numeral Systems: CMPS 255 - Computer Architecture

The document discusses numeral systems including Roman, Arabic, binary, octal and hexadecimal. It explains the key concepts of positional notation and how numbers are represented in each system. Conversion between decimal, binary, octal and hexadecimal is demonstrated through examples of addition, subtraction and multiplication in different numeral systems.

Uploaded by

samah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

Numeral Systems: CMPS 255 - Computer Architecture

The document discusses numeral systems including Roman, Arabic, binary, octal and hexadecimal. It explains the key concepts of positional notation and how numbers are represented in each system. Conversion between decimal, binary, octal and hexadecimal is demonstrated through examples of addition, subtraction and multiplication in different numeral systems.

Uploaded by

samah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Lecture 3:

Numeral Systems
CMPS 255 – Computer Architecture
Announcements
• Exam 2 rescheduled due to accommodate students
with time conflicts
• New date: Tue, Nov 12 @ 6:00-8:00pm
• Please inform us this week if you have any time conflicts
with the new date

• Office hours changed to accommodate students


with time conflicts
• Bdeir: MWF @ 2:00-3:00pm or by appointment
• El Hajj: M @ 1:00pm-2:30pm, W @ 11:00am-12:30pm,
or by appointment
Numeral Systems
• A numeral system is a notation for representing
numbers

• It consists of:
• A set of symbols each representing a value
• A set of rules for combining symbols to represent other
values
Roman Numeral System
Symbols
I one
MMCXLIV
V five
X ten
L fifty
C hundred
M+M+C–X+L–I+V
(two thousand one hundred forty four)
D five hundred
M one thousand
Arabic Numeral System
Symbols
0 zero
2735
1 one
2 two
3 three
4 four
2×103 + 7×102 + 3×101 + 5×100
5 five Ten is an important number here!
6 six • We have ten symbols whose values corresponding
7 seven to the first ten natural numbers
8 eight • Symbols are combined to represent other values
9 nine by multiplying the value of each symbol by ten to
the power of its position and adding them
Another name for this system is the decimal system
Positional Numeral Systems
• In general, a positional numeral system with a
base B is a numeral system where:
• B symbols are used whose values correspond to the first
B natural numbers
• Symbols are combined to represent other values by
multiplying the value of each symbol by B to the power
of its position and adding them
snsn-1…s1s0

sn×Bn + sn-1×Bn-1 + … + s1×B1 + s0×B0


• The decimal system is a positional numeral system
with base ten
A Numeral System for Computers
• Computers are comprised of circuits that store
charge and process electric signals in one of two
states: high voltage or low voltage

• For this reason, a numeral system for computers


ought to have only two symbols (0 and 1)

• Numbers in computers are represented using a


positional numeral system with base two
• Called the binary numeral system
Binary Numeral System Examples
Decimal Binary
010 02
11012 110 12
= 1×23 + 1×22 + 0×21 + 1×20 210 102
=8+4+1 310 112
410 1002
= 1310 510 1012
610 1102
710 1112
810 10002
1101012 910 10012
=1×25 + 1×24 + 0×23 + 1×22 + 0×21 + 1×20 1010 10102
1110 10112
= 32 + 16 + 4 + 1 1210 11002
= 5310 1310 11012
1410 11102
1510 11112
Conversion from Decimal to Binary
• Conversion from decimal to binary can be done by
successively dividing the number by two and
extracting the remainder

• Example: converting 9410 to binary


94 / 2 = 47 remainder 0 (least significant digit)
46 / 2 = 23 remainder 1
23 / 2 = 11 remainder 1
11 / 2 = 5 remainder 1
5/2=2 remainder 1
2/2=1 remainder 0
1/2=0 remainder 1 (most significant digit)

Answer: 10111102
Other Numeral Systems
• Since binary can be verbose, computer scientists
sometimes use other systems in writing for brevity
• Octal: positional system with base 8
• Hexadecimal: positional system with base 16

• Conversion between these systems is straightforward


because 8 and 16 are powers of 2
Octal Numeral System Examples
Decimal Binary Octal
010 02 08
43078 110 12 18
= 4×83 + 3×82 + 0×81 + 7×80 210 102 28
= 224710 310 112 38
410 1002 48
510 1012 58
610 1102 68
710 1112 78
810 10002 108
15638 910 10012 118
= 1×83 + 5×82 + 6×81 + 3×80 1010 10102 128
1110 10112 138
= 88310 1210 11002 148
1310 11012 158
1410 11102 168
1510 11112 178
Octal-Binary Conversion
• Every three binary digits (bits) correspond to one
octal digit

• Examples:
• Convert 101101011100011002 to octal
010 110 101 110 001 100
2 6 5 6 1 4 Answer: 2656148

• Convert 31768 into binary


3 1 7 6
011 001 111 110 Answer: 110011111102
Hexadecimal Numeral System Examples
Decimal Binary Octal Hex.
BC1216 010 02 08 016
110 12 18 116
= B×163 + C×162 + 1×161 + 2×160 210 102 28 216
3 2
= 11×16 + 12×16 + 1×16 + 2×16 1 0
310 112 38 316
= 4814610 410 1002 48 416
510 1012 58 516
610 1102 68 616
710 1112 78 716
810 10002 108 816
CAFE16 910 10012 118 916
3 2
= C×16 + A×16 + F×16 + E×16 1 0
1010 10102 128 A16
= 12×163 + 10×162 + 15×161 + 14×160 1110 10112 138 B16
= 5196610 1210 11002 148 C16
1310 11012 158 D16
Use symbols {A,B,C,D,E,F} to represent 1410 11102 168 E16
natural numbers beyond nine 1510 11112 178 F16
Hexadecimal-Binary Conversion
• Every four bits correspond to one hexadecimal digit

• Examples:
• Convert 101101011100011002 to hexadecimal
0001 0110 1011 1000 1100
1 6 B 8 C Answer: 16B8C8

• Convert 374F16 into binary


3 7 4 F
0011 0111 0100 1111 Answer: 00110111010011112
Addition
Decimal

19
+ 62
----
Addition
Decimal

carry 1
19
+ 62
----
81
Addition
Decimal Binary

carry 1
19 10011
+ 62 111110
---- -------
81
Addition
Decimal Binary

carry 1 11111
19 0010011
+ 62 0111110
---- -------
81 1010001
Subtraction
Decimal

5 1
- 2 2
-------
Subtraction
Decimal

borrow 4
5 11
- 2 2
-------
2 9
Subtraction
Decimal Binary

borrow 4
5 11 1 1 0 0 1 1
- 2 2 1 0 1 1 0
------- ----------------
2 9
Subtraction
Decimal Binary

borrow 4 0 101
5 11 1 1 0 10 1 1
- 2 2 1 0 1 1 0
------- ----------------
2 9 1 1 1 0 1
Multiplication
Decimal

23
× 13
----
Multiplication
Decimal

23
× 13
----
69
23
----
299
Multiplication
Decimal Binary

23 10111
× 13 1101
---- ------
69
23
----
299
Multiplication
Decimal Binary

23 10111
× 13 1101
---- ------
69 10111
23 00000
---- 10111
299 10111
---------
100101011

You might also like