SlideShare uma empresa Scribd logo
1 de 61
1CMPE12c Gabriel Hugh Elkaim
Number Systems
2
CMPE12c Gabriel Hugh Elkaim
A Brief History of Numbers
From Gonick, Cartoon Guide to Computer Science
3
CMPE12c Gabriel Hugh Elkaim
4
CMPE12c Gabriel Hugh Elkaim
5
CMPE12c Gabriel Hugh Elkaim
Prehistoric Ledgers
6
CMPE12c Gabriel Hugh Elkaim
7
CMPE12c Gabriel Hugh Elkaim
Elaborate Finger Counting
8
CMPE12c Gabriel Hugh Elkaim
9
CMPE12c Gabriel Hugh Elkaim
10
CMPE12c Gabriel Hugh Elkaim
11
CMPE12c Gabriel Hugh Elkaim
Ancient Number Systems
12
CMPE12c Gabriel Hugh Elkaim
13
CMPE12c Gabriel Hugh Elkaim
Positional Number Systems
14
CMPE12c Gabriel Hugh Elkaim
15
CMPE12c Gabriel Hugh Elkaim
16
CMPE12c Gabriel Hugh Elkaim
17
CMPE12c Gabriel Hugh Elkaim
18
CMPE12c Gabriel Hugh Elkaim
19
CMPE12c Gabriel Hugh Elkaim
Number Systems
• Prehistory
Unary, or marks:
/////// = 7
/////// + ////// = /////////////
• Grouping lead to Roman Numerals:
VII + V = VVII = XII
• Better, Arabic Numerals:
7 + 5 = 12 = 1 x 10 + 2
20
CMPE12c Gabriel Hugh Elkaim
Positional Number System
• Base 10 is a special case of positional
number system
• PNS First used over 4000 years ago in
Mesopotamia (Iraq)
– Base 60
– 0...59 (written as 60 different symbols)
– 5,4560 = 5 x 60 + 45 = 34510
• Positional Number Systems are great for
algebra
• Why?
21
CMPE12c Gabriel Hugh Elkaim
Arabic Numerals
• 345 is really
– 3 x 102
+ 4 x 101
+ 5 x 100
– 3 x 100 + 4 x 10 + 5 x 1
– 3 is the most significant symbol (carries the most
weight)
– 5 is the least significant symbol (carries the least
weight)
• Digits (or symbols) allowed: 0-9
• Base (or radix): 10
22
CMPE12c Gabriel Hugh Elkaim
Try multiplication in (non-positional) Roman numerals!
XXXIII (33 in decimal)
XII (12 in decimal)
---------
XXXIII
XXXIII
CCCXXX
-----------
CCCXXXXXXXXXIIIIII
-----------
CCCLXXXXVI
-----------
CCCXCVI = 396 in decimal
Positional Number System
The
Mesopotamians
wouldn’t have
had this
problem!!
*
+
23
CMPE12c Gabriel Hugh Elkaim
• There are many ways to “represent” a number
• Representation does not affect computation result
LIX + XXXIII = LXXXXII (Roman)
59 + 33 = 92 (Decimal)
• Representation affects difficulty of computing results
• Computers need a representation that works with fast
electronic circuits
• Positional numbers work great with 2-state devices
Positional Number System
24
CMPE12c Gabriel Hugh Elkaim
25
CMPE12c Gabriel Hugh Elkaim
26
CMPE12c Gabriel Hugh Elkaim
What ’10’ Means
27
CMPE12c Gabriel Hugh Elkaim
Number Base Systems
28
CMPE12c Gabriel Hugh Elkaim
Binary Numbers
29
CMPE12c Gabriel Hugh Elkaim
30
CMPE12c Gabriel Hugh Elkaim
The Powers of 2
31
CMPE12c Gabriel Hugh Elkaim
32
CMPE12c Gabriel Hugh Elkaim
Equivalent Numbers
33
CMPE12c Gabriel Hugh Elkaim
Converting Binary to Decimal
34
CMPE12c Gabriel Hugh Elkaim
•Base (radix): 2
•Digits (symbols) allowed: 0, 1
•Binary Digits, or bits
•10012 is really
1 x 23
+ 0 x 22
+ 0 X 21
+ 1 X 20
910
•110002 is really
1 x 24
+ 1 x 23
+ 0 x 22
+ 0 x 21
+ 0 x 20
2410
Binary Number System
35
CMPE12c Gabriel Hugh Elkaim
Computers multiply Arabic numerals by
converting to binary, multiplying and
converting back (much as us with Roman
numerals)
Binary Number System
So if the computer is all binary how does
it multiply 5 by 324 when I type it in the
calculator program?
36
CMPE12c Gabriel Hugh Elkaim
Octal Number System
• Base (radix): 8
• Digits (symbols): 0 – 7
• 3458 is really
– 3 x 82
+ 4 x 81
+ 5 x 80
– 192 + 32 + 5
– 22910
• 10018 is really
– 1 x 83
+ 0 x 82
+ 0 x 81
+ 1 x 80
– 512 + 1
– 51310
• In C, octal numbers are represented with a
leading 0 (0345 or 01001).
37
CMPE12c Gabriel Hugh Elkaim
Hexadecimal Number System
• Base (radix): 16
• Digits (symbols) allowed: 0 – 9, a – f
Hex Decimal
a 10
b 11
c 12
d 13
e 14
f 15
38
CMPE12c Gabriel Hugh Elkaim
A316 is really:
A x 161
+ 3 x 160
160 + 3
16310
3E816 is really:
3 x 162
+ E x 161
+ 8 x 160
3 x 256 + 14 x 16 + 8 x 1
768 + 224 + 8
100010
Hexadecimal Number System
Some Examples of converting hex numbers
to decimal
39
CMPE12c Gabriel Hugh Elkaim
10C16 is really:
1 x 162
+ 0 x 161
+ C x 160
1 x 256 + 12 x 16
256 + 192
44810
In C, hex numbers are represented with a leading
“0x” (for example “0xa3” or “0x10c”).
Hexadecimal Number System
40
CMPE12c Gabriel Hugh Elkaim
For any positional number system
•Base (radix): b
•Digits (symbols): 0 … b – 1
•Sn-1Sn-2….S2S1S0
Use summation to transform any base to
decimal
Value = Σ (Sibi
)
n-1
i=0
Positional Number System
41
CMPE12c Gabriel Hugh Elkaim
More PNS fun
• 21203 =
• 4035 =
• 2717 =
• 3569 =
• 11102 =
• 2A612 =
• BEEF16 =
=6910
=10310
=4110
=29410
=1410
=41410
=4887910
42
CMPE12c Gabriel Hugh Elkaim
Decimal → Binary Conversion
• Divide decimal value by 2 until the value is 0
• Know your powers of two and subtract
… 256 128 64 32 16 8 4 2 1
• Example: 42
• What is the biggest power of two that fits?
• What is the remainder?
• What fits?
• What is the remainder?
• What fits?
• What is the binary representation?
43
CMPE12c Gabriel Hugh Elkaim
0
2
1
2
2
2
5
2
10
2
21
2
43
2
86
2
172
2
345
345
10101
1001
→→→→→→
→→→→⇔
b10101100134510 ⇔
Decimal → Binary Conversion
44
CMPE12c Gabriel Hugh Elkaim
Decimal → Binary Conversion
• 12810=
• 31010=
• 2610=
45
CMPE12c Gabriel Hugh Elkaim
Binary → Octal Conversion
• Group into 3’s starting at least significant symbol
• Add leading 0’s if needed (why not trailing?)
• Write 1 octal digit for each group
• Examples:
100 010 111 (binary)
4 2 7 (octal)
10 101 110 (binary)
2 5 6 (octal)
46
CMPE12c Gabriel Hugh Elkaim
Octal → Binary Conversion
It is simple, just write down the 3-bit binary code for
each octal digit
Octal Binary
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
47
CMPE12c Gabriel Hugh Elkaim
Binary → Hex Conversion
• Group into 4’s starting at least significant symbol
| Adding leading 0’s if needed
• Write 1 hex digit for each group
• Examples:
1001 1110 0111 0000
9 e 7 0
0001 1111 1010 0011
1 f a 3
48
CMPE12c Gabriel Hugh Elkaim
Hex → Binary Conversion
Again, simply write down the 4 bit binary code for
each hex digit
Example:
3 9 c 8
0011 1001 1100 1000
49
CMPE12c Gabriel Hugh Elkaim
Conversion Table
Decimal Hexadecimal Octal Binary
0 0 0 0000
1 1 1 0001
2 2 2 0010
3 3 3 0011
4 4 4 0100
5 5 5 0101
6 6 6 0110
7 7 7 0111
8 8 10 1000
9 9 11 1001
10 A 12 1010
11 B 13 1011
12 C 14 1100
13 D 15 1101
14 E 16 1110
15 F 17 1111
50
CMPE12c Gabriel Hugh Elkaim
51
CMPE12c Gabriel Hugh Elkaim
Hex → Octal
•Do it in 2 steps, hex → binary → octal
Decimal → Hex
•Do it in 2 steps, decimal → binary → hex
So why use hex and octal and not just binary
and decimal?
52
CMPE12c Gabriel Hugh Elkaim
Negative Integers
• Most humans precede number with “-”
(e.g., -2000)
• Accountants, however, use parentheses:
(2000) or color 2000
• Sign-magnitude format
• Example: -1000 in hex?
100010 = 3 x 162
+ e x 161
+ 8 x 160
-3E816
53
CMPE12c Gabriel Hugh Elkaim
Mesopotamians used positional fractions
Sqrt(2) = 1.24,51,1060
= 1 x 600
+ 24 x 60-1
+ 51 x 60-2
+
10 x 60-3
= 1.41422210
Most accurate approximation until the
Renaissance
54
CMPE12c Gabriel Hugh Elkaim
fn-1
fn-2
… f2
f1
f0
f-1
f-2
f-3
… fm-1
Radix point
Generalized Representation
For a number “f” with ‘n’ digits to the left and ‘m’ to the right
of the decimal place
Position is the power
55
CMPE12c Gabriel Hugh Elkaim
Fractional Representation
• What is 3E.8F16?
• How about 10.1012?
= 3 x 161
+ E x 160
+ 8 x 16-1
+ F x 16-2
= 48 + 14 + 8/16 + 15/256
= 1 x 21
+ 0 x 20
+ 1 x 2-1
+ 0 x 2-2
+ 1 x 2-3
= 2 + 0 + 1/2 + 1/8
56
CMPE12c Gabriel Hugh Elkaim
More PNS Fractional Fun
• 21.0123 =
• 4.1335 =
• 22.617 =
• A.3A12 =
57
CMPE12c Gabriel Hugh Elkaim
Converting Decimal → Binary fractions
• Consider left and right of the decimal point
separately.
• The stuff to the left can be converted to binary
as before.
• Use the following table/algorithm to convert the
fraction
58
CMPE12c Gabriel Hugh Elkaim
Fraction Fraction x 2 Digit left of decimal point
0.8 1.6 1  most significant (f-1)
0.6 1.2 1
0.2 0.4 0
0.4 0.8 0
0.8 (it must repeat
from here!!)
• Different bases have different repeating fractions.
• 0.810 = 0.110011001100…2 = 0.11002
• Numbers can repeat in one base and not in another.
For 0.810 to binary
59
CMPE12c Gabriel Hugh Elkaim
What is 2.210 in:
•Binary
•Hex
60
CMPE12c Gabriel Hugh Elkaim
61
CMPE12c Gabriel Hugh Elkaim

Mais conteúdo relacionado

Mais procurados

Lec13 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Sh...
Lec13 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Sh...Lec13 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Sh...
Lec13 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Sh...Hsien-Hsin Sean Lee, Ph.D.
 
Decimal to Binary Conversion
Decimal to Binary ConversionDecimal to Binary Conversion
Decimal to Binary Conversionadil raja
 
Ejercicios de verano para primero de eso
Ejercicios de verano para primero de esoEjercicios de verano para primero de eso
Ejercicios de verano para primero de esoangusoo
 
Math 6 (Please download first to activate the different animation settings)
Math 6 (Please download first to activate the different animation  settings)Math 6 (Please download first to activate the different animation  settings)
Math 6 (Please download first to activate the different animation settings)Eddie Abug
 
หลักทรัพย์เพื่อค้าและตั๋วเงินรับ
หลักทรัพย์เพื่อค้าและตั๋วเงินรับหลักทรัพย์เพื่อค้าและตั๋วเงินรับ
หลักทรัพย์เพื่อค้าและตั๋วเงินรับrunglawan_aum
 
Number systems - binary, BCD, 2s comp
Number systems - binary, BCD, 2s compNumber systems - binary, BCD, 2s comp
Number systems - binary, BCD, 2s compmrlee2014
 
Arithmetic logic units
Arithmetic logic unitsArithmetic logic units
Arithmetic logic unitsowaisahmad125
 
Multiplication phone
Multiplication phoneMultiplication phone
Multiplication phonesummerportal8
 

Mais procurados (19)

Lec13 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Sh...
Lec13 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Sh...Lec13 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Sh...
Lec13 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- Sh...
 
Vedic part 1
Vedic part 1Vedic part 1
Vedic part 1
 
Decimal to Binary Conversion
Decimal to Binary ConversionDecimal to Binary Conversion
Decimal to Binary Conversion
 
set induction
set inductionset induction
set induction
 
Maths micro teaching copy
Maths micro teaching   copyMaths micro teaching   copy
Maths micro teaching copy
 
Checksum & Hamming Code
Checksum & Hamming CodeChecksum & Hamming Code
Checksum & Hamming Code
 
Digital u1
Digital u1Digital u1
Digital u1
 
Ejercicios de verano para primero de eso
Ejercicios de verano para primero de esoEjercicios de verano para primero de eso
Ejercicios de verano para primero de eso
 
Tarea de Matematicas
Tarea de MatematicasTarea de Matematicas
Tarea de Matematicas
 
Logic gates
Logic gatesLogic gates
Logic gates
 
ChRistian
ChRistianChRistian
ChRistian
 
Moooniiikitha
MoooniiikithaMoooniiikitha
Moooniiikitha
 
Math 6 (Please download first to activate the different animation settings)
Math 6 (Please download first to activate the different animation  settings)Math 6 (Please download first to activate the different animation  settings)
Math 6 (Please download first to activate the different animation settings)
 
หลักทรัพย์เพื่อค้าและตั๋วเงินรับ
หลักทรัพย์เพื่อค้าและตั๋วเงินรับหลักทรัพย์เพื่อค้าและตั๋วเงินรับ
หลักทรัพย์เพื่อค้าและตั๋วเงินรับ
 
Number systems - binary, BCD, 2s comp
Number systems - binary, BCD, 2s compNumber systems - binary, BCD, 2s comp
Number systems - binary, BCD, 2s comp
 
Arithmatic &Logic Unit
Arithmatic &Logic UnitArithmatic &Logic Unit
Arithmatic &Logic Unit
 
Arithmetic logic units
Arithmetic logic unitsArithmetic logic units
Arithmetic logic units
 
Arithmetic Logic
Arithmetic LogicArithmetic Logic
Arithmetic Logic
 
Multiplication phone
Multiplication phoneMultiplication phone
Multiplication phone
 

Destaque

Database fundamentals(database)
Database fundamentals(database)Database fundamentals(database)
Database fundamentals(database)welcometofacebook
 
Internetworking fundamentals(networking)
Internetworking fundamentals(networking)Internetworking fundamentals(networking)
Internetworking fundamentals(networking)welcometofacebook
 
Ip -subnetting
Ip  -subnettingIp  -subnetting
Ip -subnettingnithinj54
 
Math1003 1.11 - Hex to Binary Conversion
Math1003 1.11 - Hex to Binary ConversionMath1003 1.11 - Hex to Binary Conversion
Math1003 1.11 - Hex to Binary Conversiongcmath1003
 
Math1003 1.1 - Sets of Numbers
Math1003 1.1 - Sets of NumbersMath1003 1.1 - Sets of Numbers
Math1003 1.1 - Sets of Numbersgcmath1003
 
Math1003 welcome-13 w
Math1003 welcome-13 wMath1003 welcome-13 w
Math1003 welcome-13 wgcmath1003
 
Math1003 1.10 - Binary to Hex Conversion
Math1003 1.10 - Binary to Hex ConversionMath1003 1.10 - Binary to Hex Conversion
Math1003 1.10 - Binary to Hex Conversiongcmath1003
 
Converting ipv4 to ipv6 and vice versa
Converting ipv4 to ipv6 and vice versaConverting ipv4 to ipv6 and vice versa
Converting ipv4 to ipv6 and vice versaNetProtocol Xpert
 
Password recovery cisco catalyst 3850
Password recovery cisco catalyst 3850Password recovery cisco catalyst 3850
Password recovery cisco catalyst 3850NetProtocol Xpert
 
Math1003 1.9 - Converting Decimal to Binary and Hex
Math1003 1.9 - Converting Decimal to Binary and HexMath1003 1.9 - Converting Decimal to Binary and Hex
Math1003 1.9 - Converting Decimal to Binary and Hexgcmath1003
 
IP Addressing and Subnetting Basics
IP Addressing and Subnetting BasicsIP Addressing and Subnetting Basics
IP Addressing and Subnetting BasicsRowell Dionicio
 
Math1003 1.12 - Binary Addition
Math1003 1.12 - Binary AdditionMath1003 1.12 - Binary Addition
Math1003 1.12 - Binary Additiongcmath1003
 
CyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & SubnettingCyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & SubnettingVivek chan
 
Pjsmith ip addressing & subnetting madeeasy
Pjsmith ip addressing & subnetting madeeasyPjsmith ip addressing & subnetting madeeasy
Pjsmith ip addressing & subnetting madeeasyKashif Sohail
 
Math1003 1.8 - Converting from Binary and Hex to Decimal
Math1003 1.8 - Converting from Binary and Hex to DecimalMath1003 1.8 - Converting from Binary and Hex to Decimal
Math1003 1.8 - Converting from Binary and Hex to Decimalgcmath1003
 
ITFT - IP adressing
 ITFT - IP adressing ITFT - IP adressing
ITFT - IP adressingNavneet Kaur
 
Math1003 1.6 - Binary Number System
Math1003 1.6 - Binary Number SystemMath1003 1.6 - Binary Number System
Math1003 1.6 - Binary Number Systemgcmath1003
 

Destaque (20)

Database fundamentals(database)
Database fundamentals(database)Database fundamentals(database)
Database fundamentals(database)
 
Internetworking fundamentals(networking)
Internetworking fundamentals(networking)Internetworking fundamentals(networking)
Internetworking fundamentals(networking)
 
Ip -subnetting
Ip  -subnettingIp  -subnetting
Ip -subnetting
 
Subnetting
SubnettingSubnetting
Subnetting
 
Math1003 1.11 - Hex to Binary Conversion
Math1003 1.11 - Hex to Binary ConversionMath1003 1.11 - Hex to Binary Conversion
Math1003 1.11 - Hex to Binary Conversion
 
Math1003 1.1 - Sets of Numbers
Math1003 1.1 - Sets of NumbersMath1003 1.1 - Sets of Numbers
Math1003 1.1 - Sets of Numbers
 
Math1003 welcome-13 w
Math1003 welcome-13 wMath1003 welcome-13 w
Math1003 welcome-13 w
 
IP Addressing
IP AddressingIP Addressing
IP Addressing
 
Math1003 1.10 - Binary to Hex Conversion
Math1003 1.10 - Binary to Hex ConversionMath1003 1.10 - Binary to Hex Conversion
Math1003 1.10 - Binary to Hex Conversion
 
Converting ipv4 to ipv6 and vice versa
Converting ipv4 to ipv6 and vice versaConverting ipv4 to ipv6 and vice versa
Converting ipv4 to ipv6 and vice versa
 
Password recovery cisco catalyst 3850
Password recovery cisco catalyst 3850Password recovery cisco catalyst 3850
Password recovery cisco catalyst 3850
 
Math1003 1.9 - Converting Decimal to Binary and Hex
Math1003 1.9 - Converting Decimal to Binary and HexMath1003 1.9 - Converting Decimal to Binary and Hex
Math1003 1.9 - Converting Decimal to Binary and Hex
 
Ch05
Ch05Ch05
Ch05
 
IP Addressing and Subnetting Basics
IP Addressing and Subnetting BasicsIP Addressing and Subnetting Basics
IP Addressing and Subnetting Basics
 
Math1003 1.12 - Binary Addition
Math1003 1.12 - Binary AdditionMath1003 1.12 - Binary Addition
Math1003 1.12 - Binary Addition
 
CyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & SubnettingCyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & Subnetting
 
Pjsmith ip addressing & subnetting madeeasy
Pjsmith ip addressing & subnetting madeeasyPjsmith ip addressing & subnetting madeeasy
Pjsmith ip addressing & subnetting madeeasy
 
Math1003 1.8 - Converting from Binary and Hex to Decimal
Math1003 1.8 - Converting from Binary and Hex to DecimalMath1003 1.8 - Converting from Binary and Hex to Decimal
Math1003 1.8 - Converting from Binary and Hex to Decimal
 
ITFT - IP adressing
 ITFT - IP adressing ITFT - IP adressing
ITFT - IP adressing
 
Math1003 1.6 - Binary Number System
Math1003 1.6 - Binary Number SystemMath1003 1.6 - Binary Number System
Math1003 1.6 - Binary Number System
 

Semelhante a 3 number systems

NumberSystems.pptx
NumberSystems.pptxNumberSystems.pptx
NumberSystems.pptxvijayapraba1
 
NumberSystems.pptx
NumberSystems.pptxNumberSystems.pptx
NumberSystems.pptxvijayapraba1
 
03_NumberSystems.pdf
03_NumberSystems.pdf03_NumberSystems.pdf
03_NumberSystems.pdfvijayapraba1
 
Number system utm notes
Number system utm notesNumber system utm notes
Number system utm notesKurenai Ryu
 
01.number systems
01.number systems01.number systems
01.number systemsrasha3
 
Number systems
Number systemsNumber systems
Number systemsKumar
 
digital-electronics.pptx
digital-electronics.pptxdigital-electronics.pptx
digital-electronics.pptxsulekhasaxena2
 
W2 Chapter 2A Notes CCB1223 Digital Logic.pdf
W2 Chapter 2A Notes CCB1223 Digital Logic.pdfW2 Chapter 2A Notes CCB1223 Digital Logic.pdf
W2 Chapter 2A Notes CCB1223 Digital Logic.pdfMOHDZAMRIBINIBRAHIM1
 
digital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed pointdigital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed pointRai University
 
Mca i-u-1.1 digital logic circuits, digital component floting and fixed point
Mca i-u-1.1 digital logic circuits, digital component floting and fixed pointMca i-u-1.1 digital logic circuits, digital component floting and fixed point
Mca i-u-1.1 digital logic circuits, digital component floting and fixed pointRai University
 
21EC201– Digital Principles and system design.pptx
21EC201– Digital Principles and system design.pptx21EC201– Digital Principles and system design.pptx
21EC201– Digital Principles and system design.pptxGobinathAECEJRF1101
 
digital-logic-design-cs302-power-point-slides-lecture-01.ppt
digital-logic-design-cs302-power-point-slides-lecture-01.pptdigital-logic-design-cs302-power-point-slides-lecture-01.ppt
digital-logic-design-cs302-power-point-slides-lecture-01.pptAsadAli715892
 
Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...
Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...
Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...Rai University
 

Semelhante a 3 number systems (20)

NumberSystems.pptx
NumberSystems.pptxNumberSystems.pptx
NumberSystems.pptx
 
NumberSystems.pptx
NumberSystems.pptxNumberSystems.pptx
NumberSystems.pptx
 
03_NumberSystems.pdf
03_NumberSystems.pdf03_NumberSystems.pdf
03_NumberSystems.pdf
 
Number system utm notes
Number system utm notesNumber system utm notes
Number system utm notes
 
Unit 4.docx
Unit 4.docxUnit 4.docx
Unit 4.docx
 
01.number systems
01.number systems01.number systems
01.number systems
 
Cse115 lecture01numbersystems
Cse115 lecture01numbersystemsCse115 lecture01numbersystems
Cse115 lecture01numbersystems
 
Digital Electronics Notes.pdf
Digital Electronics Notes.pdfDigital Electronics Notes.pdf
Digital Electronics Notes.pdf
 
Number systems
Number systemsNumber systems
Number systems
 
digital-electronics.pptx
digital-electronics.pptxdigital-electronics.pptx
digital-electronics.pptx
 
W2 Chapter 2A Notes CCB1223 Digital Logic.pdf
W2 Chapter 2A Notes CCB1223 Digital Logic.pdfW2 Chapter 2A Notes CCB1223 Digital Logic.pdf
W2 Chapter 2A Notes CCB1223 Digital Logic.pdf
 
dld 01-introduction
dld 01-introductiondld 01-introduction
dld 01-introduction
 
2013 1
2013 1 2013 1
2013 1
 
digital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed pointdigital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed point
 
Mca i-u-1.1 digital logic circuits, digital component floting and fixed point
Mca i-u-1.1 digital logic circuits, digital component floting and fixed pointMca i-u-1.1 digital logic circuits, digital component floting and fixed point
Mca i-u-1.1 digital logic circuits, digital component floting and fixed point
 
21EC201– Digital Principles and system design.pptx
21EC201– Digital Principles and system design.pptx21EC201– Digital Principles and system design.pptx
21EC201– Digital Principles and system design.pptx
 
digital-logic-design-cs302-power-point-slides-lecture-01.ppt
digital-logic-design-cs302-power-point-slides-lecture-01.pptdigital-logic-design-cs302-power-point-slides-lecture-01.ppt
digital-logic-design-cs302-power-point-slides-lecture-01.ppt
 
number system 1.pptx
number system 1.pptxnumber system 1.pptx
number system 1.pptx
 
Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...
Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...
Bca 2nd sem u-1.1 digital logic circuits, digital component floting and fixed...
 
Number systems r002
Number systems  r002Number systems  r002
Number systems r002
 

Mais de Munna Kumar Yadav

Presentation on working capital management by munna kumar yadav mba
Presentation on working capital management by munna kumar yadav mbaPresentation on working capital management by munna kumar yadav mba
Presentation on working capital management by munna kumar yadav mbaMunna Kumar Yadav
 
Format of resume design by Mr. Munna Kumar Yadav from Dewanganj Rural Municip...
Format of resume design by Mr. Munna Kumar Yadav from Dewanganj Rural Municip...Format of resume design by Mr. Munna Kumar Yadav from Dewanganj Rural Municip...
Format of resume design by Mr. Munna Kumar Yadav from Dewanganj Rural Municip...Munna Kumar Yadav
 
Format of summer training report by munna kumar yadav (MBA)
Format of summer training report by munna kumar yadav (MBA)Format of summer training report by munna kumar yadav (MBA)
Format of summer training report by munna kumar yadav (MBA)Munna Kumar Yadav
 
Summer training report on service quality of NCC Bank by Munna kumar yadav f...
Summer training report on service quality of NCC Bank  by Munna kumar yadav f...Summer training report on service quality of NCC Bank  by Munna kumar yadav f...
Summer training report on service quality of NCC Bank by Munna kumar yadav f...Munna Kumar Yadav
 
Working capital management of ncc bank ltd. prepared by Munna kumar yadaav
Working capital management of ncc bank ltd. prepared by Munna kumar yadaavWorking capital management of ncc bank ltd. prepared by Munna kumar yadaav
Working capital management of ncc bank ltd. prepared by Munna kumar yadaavMunna Kumar Yadav
 
Training Report on Employees Satisfaction of Everest Bank Ltd. upload by Munn...
Training Report on Employees Satisfaction of Everest Bank Ltd. upload by Munn...Training Report on Employees Satisfaction of Everest Bank Ltd. upload by Munn...
Training Report on Employees Satisfaction of Everest Bank Ltd. upload by Munn...Munna Kumar Yadav
 
Front page of employees satisfaction upload by Munna Yadav
Front page of employees satisfaction upload by Munna YadavFront page of employees satisfaction upload by Munna Yadav
Front page of employees satisfaction upload by Munna YadavMunna Kumar Yadav
 
Personality development upload by Munna Yadav
Personality development upload by Munna YadavPersonality development upload by Munna Yadav
Personality development upload by Munna YadavMunna Kumar Yadav
 
Classroom management upload by Munna Yadav
Classroom management upload by Munna YadavClassroom management upload by Munna Yadav
Classroom management upload by Munna YadavMunna Kumar Yadav
 

Mais de Munna Kumar Yadav (9)

Presentation on working capital management by munna kumar yadav mba
Presentation on working capital management by munna kumar yadav mbaPresentation on working capital management by munna kumar yadav mba
Presentation on working capital management by munna kumar yadav mba
 
Format of resume design by Mr. Munna Kumar Yadav from Dewanganj Rural Municip...
Format of resume design by Mr. Munna Kumar Yadav from Dewanganj Rural Municip...Format of resume design by Mr. Munna Kumar Yadav from Dewanganj Rural Municip...
Format of resume design by Mr. Munna Kumar Yadav from Dewanganj Rural Municip...
 
Format of summer training report by munna kumar yadav (MBA)
Format of summer training report by munna kumar yadav (MBA)Format of summer training report by munna kumar yadav (MBA)
Format of summer training report by munna kumar yadav (MBA)
 
Summer training report on service quality of NCC Bank by Munna kumar yadav f...
Summer training report on service quality of NCC Bank  by Munna kumar yadav f...Summer training report on service quality of NCC Bank  by Munna kumar yadav f...
Summer training report on service quality of NCC Bank by Munna kumar yadav f...
 
Working capital management of ncc bank ltd. prepared by Munna kumar yadaav
Working capital management of ncc bank ltd. prepared by Munna kumar yadaavWorking capital management of ncc bank ltd. prepared by Munna kumar yadaav
Working capital management of ncc bank ltd. prepared by Munna kumar yadaav
 
Training Report on Employees Satisfaction of Everest Bank Ltd. upload by Munn...
Training Report on Employees Satisfaction of Everest Bank Ltd. upload by Munn...Training Report on Employees Satisfaction of Everest Bank Ltd. upload by Munn...
Training Report on Employees Satisfaction of Everest Bank Ltd. upload by Munn...
 
Front page of employees satisfaction upload by Munna Yadav
Front page of employees satisfaction upload by Munna YadavFront page of employees satisfaction upload by Munna Yadav
Front page of employees satisfaction upload by Munna Yadav
 
Personality development upload by Munna Yadav
Personality development upload by Munna YadavPersonality development upload by Munna Yadav
Personality development upload by Munna Yadav
 
Classroom management upload by Munna Yadav
Classroom management upload by Munna YadavClassroom management upload by Munna Yadav
Classroom management upload by Munna Yadav
 

Último

High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSsandhya757531
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书rnrncn29
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfManish Kumar
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingBootNeck1
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfalene1
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSneha Padhiar
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsapna80328
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfisabel213075
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdfsahilsajad201
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Coursebim.edu.pl
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Communityprachaibot
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming languageSmritiSharma901052
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTSneha Padhiar
 

Último (20)

High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event Scheduling
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveying
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdf
 
Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptxDesigning pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdf
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Community
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming language
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
 

3 number systems

  • 1. 1CMPE12c Gabriel Hugh Elkaim Number Systems
  • 2. 2 CMPE12c Gabriel Hugh Elkaim A Brief History of Numbers From Gonick, Cartoon Guide to Computer Science
  • 5. 5 CMPE12c Gabriel Hugh Elkaim Prehistoric Ledgers
  • 7. 7 CMPE12c Gabriel Hugh Elkaim Elaborate Finger Counting
  • 11. 11 CMPE12c Gabriel Hugh Elkaim Ancient Number Systems
  • 13. 13 CMPE12c Gabriel Hugh Elkaim Positional Number Systems
  • 19. 19 CMPE12c Gabriel Hugh Elkaim Number Systems • Prehistory Unary, or marks: /////// = 7 /////// + ////// = ///////////// • Grouping lead to Roman Numerals: VII + V = VVII = XII • Better, Arabic Numerals: 7 + 5 = 12 = 1 x 10 + 2
  • 20. 20 CMPE12c Gabriel Hugh Elkaim Positional Number System • Base 10 is a special case of positional number system • PNS First used over 4000 years ago in Mesopotamia (Iraq) – Base 60 – 0...59 (written as 60 different symbols) – 5,4560 = 5 x 60 + 45 = 34510 • Positional Number Systems are great for algebra • Why?
  • 21. 21 CMPE12c Gabriel Hugh Elkaim Arabic Numerals • 345 is really – 3 x 102 + 4 x 101 + 5 x 100 – 3 x 100 + 4 x 10 + 5 x 1 – 3 is the most significant symbol (carries the most weight) – 5 is the least significant symbol (carries the least weight) • Digits (or symbols) allowed: 0-9 • Base (or radix): 10
  • 22. 22 CMPE12c Gabriel Hugh Elkaim Try multiplication in (non-positional) Roman numerals! XXXIII (33 in decimal) XII (12 in decimal) --------- XXXIII XXXIII CCCXXX ----------- CCCXXXXXXXXXIIIIII ----------- CCCLXXXXVI ----------- CCCXCVI = 396 in decimal Positional Number System The Mesopotamians wouldn’t have had this problem!! * +
  • 23. 23 CMPE12c Gabriel Hugh Elkaim • There are many ways to “represent” a number • Representation does not affect computation result LIX + XXXIII = LXXXXII (Roman) 59 + 33 = 92 (Decimal) • Representation affects difficulty of computing results • Computers need a representation that works with fast electronic circuits • Positional numbers work great with 2-state devices Positional Number System
  • 26. 26 CMPE12c Gabriel Hugh Elkaim What ’10’ Means
  • 27. 27 CMPE12c Gabriel Hugh Elkaim Number Base Systems
  • 28. 28 CMPE12c Gabriel Hugh Elkaim Binary Numbers
  • 30. 30 CMPE12c Gabriel Hugh Elkaim The Powers of 2
  • 32. 32 CMPE12c Gabriel Hugh Elkaim Equivalent Numbers
  • 33. 33 CMPE12c Gabriel Hugh Elkaim Converting Binary to Decimal
  • 34. 34 CMPE12c Gabriel Hugh Elkaim •Base (radix): 2 •Digits (symbols) allowed: 0, 1 •Binary Digits, or bits •10012 is really 1 x 23 + 0 x 22 + 0 X 21 + 1 X 20 910 •110002 is really 1 x 24 + 1 x 23 + 0 x 22 + 0 x 21 + 0 x 20 2410 Binary Number System
  • 35. 35 CMPE12c Gabriel Hugh Elkaim Computers multiply Arabic numerals by converting to binary, multiplying and converting back (much as us with Roman numerals) Binary Number System So if the computer is all binary how does it multiply 5 by 324 when I type it in the calculator program?
  • 36. 36 CMPE12c Gabriel Hugh Elkaim Octal Number System • Base (radix): 8 • Digits (symbols): 0 – 7 • 3458 is really – 3 x 82 + 4 x 81 + 5 x 80 – 192 + 32 + 5 – 22910 • 10018 is really – 1 x 83 + 0 x 82 + 0 x 81 + 1 x 80 – 512 + 1 – 51310 • In C, octal numbers are represented with a leading 0 (0345 or 01001).
  • 37. 37 CMPE12c Gabriel Hugh Elkaim Hexadecimal Number System • Base (radix): 16 • Digits (symbols) allowed: 0 – 9, a – f Hex Decimal a 10 b 11 c 12 d 13 e 14 f 15
  • 38. 38 CMPE12c Gabriel Hugh Elkaim A316 is really: A x 161 + 3 x 160 160 + 3 16310 3E816 is really: 3 x 162 + E x 161 + 8 x 160 3 x 256 + 14 x 16 + 8 x 1 768 + 224 + 8 100010 Hexadecimal Number System Some Examples of converting hex numbers to decimal
  • 39. 39 CMPE12c Gabriel Hugh Elkaim 10C16 is really: 1 x 162 + 0 x 161 + C x 160 1 x 256 + 12 x 16 256 + 192 44810 In C, hex numbers are represented with a leading “0x” (for example “0xa3” or “0x10c”). Hexadecimal Number System
  • 40. 40 CMPE12c Gabriel Hugh Elkaim For any positional number system •Base (radix): b •Digits (symbols): 0 … b – 1 •Sn-1Sn-2….S2S1S0 Use summation to transform any base to decimal Value = Σ (Sibi ) n-1 i=0 Positional Number System
  • 41. 41 CMPE12c Gabriel Hugh Elkaim More PNS fun • 21203 = • 4035 = • 2717 = • 3569 = • 11102 = • 2A612 = • BEEF16 = =6910 =10310 =4110 =29410 =1410 =41410 =4887910
  • 42. 42 CMPE12c Gabriel Hugh Elkaim Decimal → Binary Conversion • Divide decimal value by 2 until the value is 0 • Know your powers of two and subtract … 256 128 64 32 16 8 4 2 1 • Example: 42 • What is the biggest power of two that fits? • What is the remainder? • What fits? • What is the remainder? • What fits? • What is the binary representation?
  • 43. 43 CMPE12c Gabriel Hugh Elkaim 0 2 1 2 2 2 5 2 10 2 21 2 43 2 86 2 172 2 345 345 10101 1001 →→→→→→ →→→→⇔ b10101100134510 ⇔ Decimal → Binary Conversion
  • 44. 44 CMPE12c Gabriel Hugh Elkaim Decimal → Binary Conversion • 12810= • 31010= • 2610=
  • 45. 45 CMPE12c Gabriel Hugh Elkaim Binary → Octal Conversion • Group into 3’s starting at least significant symbol • Add leading 0’s if needed (why not trailing?) • Write 1 octal digit for each group • Examples: 100 010 111 (binary) 4 2 7 (octal) 10 101 110 (binary) 2 5 6 (octal)
  • 46. 46 CMPE12c Gabriel Hugh Elkaim Octal → Binary Conversion It is simple, just write down the 3-bit binary code for each octal digit Octal Binary 0 000 1 001 2 010 3 011 4 100 5 101 6 110 7 111
  • 47. 47 CMPE12c Gabriel Hugh Elkaim Binary → Hex Conversion • Group into 4’s starting at least significant symbol | Adding leading 0’s if needed • Write 1 hex digit for each group • Examples: 1001 1110 0111 0000 9 e 7 0 0001 1111 1010 0011 1 f a 3
  • 48. 48 CMPE12c Gabriel Hugh Elkaim Hex → Binary Conversion Again, simply write down the 4 bit binary code for each hex digit Example: 3 9 c 8 0011 1001 1100 1000
  • 49. 49 CMPE12c Gabriel Hugh Elkaim Conversion Table Decimal Hexadecimal Octal Binary 0 0 0 0000 1 1 1 0001 2 2 2 0010 3 3 3 0011 4 4 4 0100 5 5 5 0101 6 6 6 0110 7 7 7 0111 8 8 10 1000 9 9 11 1001 10 A 12 1010 11 B 13 1011 12 C 14 1100 13 D 15 1101 14 E 16 1110 15 F 17 1111
  • 51. 51 CMPE12c Gabriel Hugh Elkaim Hex → Octal •Do it in 2 steps, hex → binary → octal Decimal → Hex •Do it in 2 steps, decimal → binary → hex So why use hex and octal and not just binary and decimal?
  • 52. 52 CMPE12c Gabriel Hugh Elkaim Negative Integers • Most humans precede number with “-” (e.g., -2000) • Accountants, however, use parentheses: (2000) or color 2000 • Sign-magnitude format • Example: -1000 in hex? 100010 = 3 x 162 + e x 161 + 8 x 160 -3E816
  • 53. 53 CMPE12c Gabriel Hugh Elkaim Mesopotamians used positional fractions Sqrt(2) = 1.24,51,1060 = 1 x 600 + 24 x 60-1 + 51 x 60-2 + 10 x 60-3 = 1.41422210 Most accurate approximation until the Renaissance
  • 54. 54 CMPE12c Gabriel Hugh Elkaim fn-1 fn-2 … f2 f1 f0 f-1 f-2 f-3 … fm-1 Radix point Generalized Representation For a number “f” with ‘n’ digits to the left and ‘m’ to the right of the decimal place Position is the power
  • 55. 55 CMPE12c Gabriel Hugh Elkaim Fractional Representation • What is 3E.8F16? • How about 10.1012? = 3 x 161 + E x 160 + 8 x 16-1 + F x 16-2 = 48 + 14 + 8/16 + 15/256 = 1 x 21 + 0 x 20 + 1 x 2-1 + 0 x 2-2 + 1 x 2-3 = 2 + 0 + 1/2 + 1/8
  • 56. 56 CMPE12c Gabriel Hugh Elkaim More PNS Fractional Fun • 21.0123 = • 4.1335 = • 22.617 = • A.3A12 =
  • 57. 57 CMPE12c Gabriel Hugh Elkaim Converting Decimal → Binary fractions • Consider left and right of the decimal point separately. • The stuff to the left can be converted to binary as before. • Use the following table/algorithm to convert the fraction
  • 58. 58 CMPE12c Gabriel Hugh Elkaim Fraction Fraction x 2 Digit left of decimal point 0.8 1.6 1  most significant (f-1) 0.6 1.2 1 0.2 0.4 0 0.4 0.8 0 0.8 (it must repeat from here!!) • Different bases have different repeating fractions. • 0.810 = 0.110011001100…2 = 0.11002 • Numbers can repeat in one base and not in another. For 0.810 to binary
  • 59. 59 CMPE12c Gabriel Hugh Elkaim What is 2.210 in: •Binary •Hex