SlideShare uma empresa Scribd logo
1 de 40
Baixar para ler offline
Number Systems




                  Spring 2010
                  Dr. David Hyland-Wood
                  University of Mary Washington
Monday, January 11, 2010
Information Encoding
                We use encoding schemes to represent and
                store information.

                • Roman Numerals:        I, IV, XL, MMIV
                • Acronyms: UMW, CPSC-125, SSGN-726
                • Postal codes: 22401, M5W 1E6
                • Musical Note Notation:
                Encoding schemes are only useful if the stored
                information can be retrieved.
Monday, January 11, 2010
Monday, January 11, 2010

Linear A has not been deciphered. This tablet stores information, but it can no longer be
retrieved. Think about floppy disks, tape drives, bad handwriting and other forms of “lost”
data.
Decimal Notation
                • base 10 or radix 10 ... uses 10 symbols
                       0, 1, 2, 3, 4, 5, 6, 7, 8, 9
                • Position represents powers of 10
                • 5473 or 5473
                             10

                       (5 * 103) + (4 * 102) + (7 * 101) + (3 * 100)
                • 73.19       10   or 73.19
                       (7 * 101) + (3 * 100) + (1 * 10-1) + (9 * 10-2)
Monday, January 11, 2010
Monday, January 11, 2010

There is an obvious reason to use base 10.
Monday, January 11, 2010

The ancient Sumerians used base 12, which is why we inherited a 12-hour clock.
Binary Notation
                • base 2 ... uses only 2 symbols
                       0, 1
                • Position represents powers of 2
                • 11010       2

                       (1 * 24) + (1 * 23) + (0 * 22) + (1 * 21) + (0 * 20)
                • 10.11       2

                       (1 * 21) + (0 * 20) + (1 * 2-1) + (1 * 2-2)
Monday, January 11, 2010
Monday, January 11, 2010

Computers are binary all the way down. Electrical signals are “on” or “off” based on voltage.
Magnetic storage systems such as hard disc drives are based on magnetism. Optical storage
systems are based on depth.
“On” or “Off”




Monday, January 11, 2010

Computers are binary all the way down. Electrical signals are “on” or “off” based on voltage.
Magnetic storage systems such as hard disc drives are based on magnetism. Optical storage
systems are based on depth.
“On” or “Off”




   voltage                                         threshold


                               time



Monday, January 11, 2010

Computers are binary all the way down. Electrical signals are “on” or “off” based on voltage.
Magnetic storage systems such as hard disc drives are based on magnetism. Optical storage
systems are based on depth.
“On” or “Off”




                                                                  “On”
   voltage                                         threshold
                                                                  “Off”
                               time



Monday, January 11, 2010

Computers are binary all the way down. Electrical signals are “on” or “off” based on voltage.
Magnetic storage systems such as hard disc drives are based on magnetism. Optical storage
systems are based on depth.
“On” or “Off”




                                                                  “On” 1
   voltage                                         threshold
                                                                  “Off” 0
                               time



Monday, January 11, 2010

Computers are binary all the way down. Electrical signals are “on” or “off” based on voltage.
Magnetic storage systems such as hard disc drives are based on magnetism. Optical storage
systems are based on depth.
“On” or “Off”




                                                                  “On” 1 True
   voltage                                         threshold
                                                                  “Off” 0 False
                               time



Monday, January 11, 2010

Computers are binary all the way down. Electrical signals are “on” or “off” based on voltage.
Magnetic storage systems such as hard disc drives are based on magnetism. Optical storage
systems are based on depth.
Octal Notation
                • base 8 ... uses 8 symbols
                       0, 1, 2, 3, 4, 5, 6, 7
                • Position represents power of 8
                • 1523        8

                       (1 *   8 3)   + (5 *   8 2)   + (2 *   8 1)   + (3 *   8 0)


                • 56.72        8

                       (5 * 81) + (6 * 80) + (7 * 8-1) + (2 * 8-2)
Monday, January 11, 2010
Hexadecimal Notation
                • base 16 or ‘hex’ ... uses 16 symbols
                       0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
                • Position represents powers of 16
                • B65F or 0xB65F
                             16

                       (11 * 163) + (6 * 162) + (5 * 161) + (15 * 160)
                • F3.A9       16   or 0xF3.A9
                       (15 * 161) + (3 * 160) + (10 * 16-1) + (9 * 16-2)
Monday, January 11, 2010
Octal and Hexadecimal

                    • Humans are accustomed to decimal
                    • Computers use binary
                    • So why ever use octal or hexadecimal?
                           •   Binary numbers can be long with a lot of digits
                           •   Longer number make for more confusion
                           •   Copying longer numbers allows greater chance for error
                           •   Octal represents binary in 1/3 the number of digits
                           •   Hexadecimal represents binary in 1/4 the number of digits

Monday, January 11, 2010
Base Conversion

                Binary to Decimal
                • 11010        2

                • (1*2 )+(1*2 )+(0*2 )+(1*2 )+(0*2 )
                           4       3   2   1      0


                • 16 + 8 + 0 + 2 + 0
                • 26

Monday, January 11, 2010
Base Conversion

                Octal to Decimal
                • 1523     8

                • (1*8 )+(5*8 )+(2*8 )+(3*8 )
                           3   2    1      0


                • 512+320+16+3
                • 851

Monday, January 11, 2010
Base Conversion

                Hexadecimal to Decimal
                • B65F     16

                • (11 * 16 ) + (6 * 16 ) + (5 * 16 ) + (15 * 16 )
                                3     2           1            0


                • 45056+1536+80+15
                • 46687

Monday, January 11, 2010
Base Conversion
                Decimal to Binary                •   25 / 2 = 12 R 1 (1101112)


                •     82310                      •   12 / 2 = 6 R 0 (01101112)


                •     823 / 2 = 411 R1(12)       •   6 / 2 = 3 R 0 (001101112)


                •     411 / 2 = 205 R 1 (112)    •   3 / 2 = 1 R 1 (1001101112)


                •     205 / 2 = 102 R 1 (1112)   •   1 / 2 = 0 R 1 (11001101112)


                •     102 / 2 = 51 R 0 (01112)   •   11001101112


                •     51 / 2 = 25 R 1 (101112)

Monday, January 11, 2010
Base Conversion
                Decimal to Octal
                • 823
                • 823 / 8 = 102 R 7 (7 ) 8

                • 102 / 8 = 12 R 6 (67 ) 8

                • 12 / 8 = 1 R 4 (467 )
                                     8

                • 1 / 8 = 0 R 1 (1467 )
                                     8

                • 1467     8

Monday, January 11, 2010
Base Conversion
                Decimal to
                Hexadecimal
                •     82310                     •   250010

                •     823 / 16 = 51 R 7 (716)   •   2500 / 16 = 156 R 4 (416)

                •     51 / 16 = 3 R 3 (3716)    •   156 / 16 = 9 R 12 (C416)

                •     3 / 16 = 0 R 3 (33716)    •   9 / 16 = 0 R 9 (9C416)

                •     33716                     •   9C416

Monday, January 11, 2010
Base Conversion
                Binary to Octal                   Octal to Binary
                •     11001101112                 •   14678

                •     (12) (1002) (1102) (1112)   •   (18) (48) (68) (78)

                •     (18) (48) (68) (78)         •   (0012) (1002) (1102) (1112)

                •     14678                       •   11001101112




Monday, January 11, 2010
Base Conversion
                Binary to                       Hexadecimal to
                Hexadecimal                     Binary
                •     10110110010111112         •   B65F16

                •     (10112) (01102) (01012)   •   (B16) (616) (516) (F16)
                      (11112)
                                                •   (10112) (01102) (01012)
                •     (B16) (616) (516) (F16)       (11112)

                •     B65F16                    •   10110110010111112


Monday, January 11, 2010
Computing Systems
                    • Computers were originally designed for the
                           primary purpose of doing numerical calculations.
                            Abacus, counting machines, calculators

                    • We still do numerical operations, but not
                           necessarily as a primary function.
                    • Computers are now “information processors”
                           and manipulate primarily nonnumeric data.
                            Text, GUIs, sounds, information structures, pointers to data
                            addresses, device drivers
Monday, January 11, 2010
Codes
                    • A code is a scheme for representing
                           information.
                    • Computers use codes to store types of
                           information.
                    • Examples of codes:
                           •   Alphabet
                           •   DNA (biological coding scheme)
                           •   Musical Score
                           •   Mathematical Equations
Monday, January 11, 2010
Codes
                    • Two Elements (always)
                           •   A group of symbols

                           •   A set of rules for interpreting these symbols

                    • Place-Value System (common)
                           •   Information varies based on location

                           •   Notes of a musical staff

                           •   Bits in a binary number



Monday, January 11, 2010
Computers and Codes
                    • Computers are built from two-state
                           electronics.
                    • Each memory location (electrical, magnetic,
                           optic) has two states (On or Off)
                    • Computers must represent all information
                           using only two symbols
                           •   On (1)
                           •   Off (0)

                    • Computers rely on binary coding schemes
Monday, January 11, 2010

Quantum computing? Tertiary-state machines? Maybe, but not yet and/or not common.
Probably coming, though.
Computers and Binary
                • Decimal
                       109

                • Binary
                       11011012

                • Computer 16-bit word size
                       0000 0000 0110 11012

                • Computer 32-bit word size
                       0000 0000 0000 0000 0000 0000 0110 11012
Monday, January 11, 2010

Many modern computers now use a 64-bit word size in their CPUs. 231 ~ 4 billion. 263 ~ 9.2
quintillion (~1019). Also IP address sizes (v4 and v6).
Binary Addition
                    • 4502 + 1234
                    • 1000110010110  2   + 100110100102
                    • 1011001101000  2

                    • 5736
                                11       1   11
                             10001100101102
                             00100110100102
                             10110011010002

Monday, January 11, 2010
Negative Numbers
                Sign-Magnitude Format
                • Uses the highest order bit as a ‘sign’ bit.    All
                       other bits are used to store the absolute value
                       (magnitude)
                • Negative numbers have the sign bit set
                • Reduces the range of values that can be stored.
                • -109 in 16-bit representation using a sign bit
                           10
                       	

 1000 0000 0110 11012
Monday, January 11, 2010
Negative Numbers
                One’s Complement Format
                • Exact opposite of the sequence for the positive
                       value. Each bit is “complemented” or “flipped”
                • 109 in 16-bit representation
                       0000 0000 0110 11012

                • -109 in 16-bit One’s Complement
                       1111 1111 1001 00102

                • This makes mathematical operations difficult
Monday, January 11, 2010
Negative Numbers
                Two’s Complement Format
                • Add 1 to One’s Complement
                • 109 in 16-bit representation
                       0000 0000 0110 11012

                • -109 in 16-bit One’s Complement
                       1111 1111 1001 00102

                • -109 in 16-bit Two’s Complement
                       1111 1111 1001 00112
Monday, January 11, 2010
Negative Numbers
                • -109 in 16-bit One’s Complement
                       1111 1111 1001 00102

                • -109 in 16-bit Two’s Complement
                                  1111 1111 1001 00102
                                + 0000 0000 0000 00012
                                  1111 1111 1001 00112



Monday, January 11, 2010
Two’s Complement Shortcut
                • 109 in 16-bit representation
                       0000 0000 0110 11012

                • -109 in 16-bit Two’s Complement:
                    • Copy everything left of the first ‘1’
                            including the first ‘1’
                            0000 0000 0110 11012
                • Complement (flip) all other bits
                            1111 1111 1001 00112


Monday, January 11, 2010
Two’s Complement Shortcut
                • 10656 in 16-bit representation
                       0010 1001 1010 00002

                • -10656 in 16-bit Two’s Complement:
                    • Copy everything left of the first ‘1’
                            including the first ‘1’
                            0010 1001 1010 00002
                • Complement (flip) all other bits
                            1101 0110 0110 00002


Monday, January 11, 2010
Two’s Complement Arithmetic
                • 4502 + (-1234)
                       Convert to binary, 16-bit representations

                           450210    0001 0001 1001 01102
                           -123410 + 1111 1011 0010 11102
                                    10000 1100 1100 01002

                • This is 17 bits – the highest order bit simply
                       gets dropped!
                           00001100110001002 = 326810

Monday, January 11, 2010
utp ut
                                                                     O
                                                             01 00
                                                     11 00
                             1               11 00
                                     00 00

                    6810                                                      Inp ut
               32                                               10
                                                          01 01
                                                     11 0
                                                              11 10
                                                00 0       10
                                           00 1
                                                    11 00
                                         0       10
                                          11 11
                               210
                           450 10
                            -1 234



Monday, January 11, 2010

Imagine that you are doing this operation in a silicon chip with only 16 pins on each side.
The 17th “bit” has nowhere to go! In actuality, the input would be preceded by an “add”
command.
Monday, January 11, 2010
Credits - CC Licensed
               Decimal numbers on shoji         http://www.flickr.com/photos/pitmanra/1184492148/



               Hands                            http://www.flickr.com/photos/faraz27989/537051865/



               Clock                            http://www.flickr.com/photos/zoutedrop/2317065892/




                                          Credits - Fair Use
               Linear A tablet                  http://www.historywiz.com/images/greece/lineara.jpg


               T-shirt                          http://www.thinkgeek.com/tshirts-apparel/unisex/frustrations/5aa9/zoom/


               8086 chip                        http://dl.maximumpc.com/galleries/x86/8086.png




Monday, January 11, 2010

Mais conteúdo relacionado

Mais de David Wood

Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsMeditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
David Wood
 
Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926
David Wood
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
David Wood
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
David Wood
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
David Wood
 

Mais de David Wood (20)

Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
 
BlockSW 2019 Keynote
BlockSW 2019 KeynoteBlockSW 2019 Keynote
BlockSW 2019 Keynote
 
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
 
Privacy in the Smart City
Privacy in the Smart CityPrivacy in the Smart City
Privacy in the Smart City
 
Controlling Complexities in Software Development
Controlling Complexities in Software DevelopmentControlling Complexities in Software Development
Controlling Complexities in Software Development
 
Privacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable ClaimsPrivacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable Claims
 
Implementing the Verifiable Claims data model
Implementing the Verifiable Claims data modelImplementing the Verifiable Claims data model
Implementing the Verifiable Claims data model
 
So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301
 
Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601
 
When Metaphors Kill
When Metaphors KillWhen Metaphors Kill
When Metaphors Kill
 
Secularism in Australia
Secularism in AustraliaSecularism in Australia
Secularism in Australia
 
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsMeditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
 
Building a writer's platform with social media
Building a writer's platform with social mediaBuilding a writer's platform with social media
Building a writer's platform with social media
 
Summary of the Hero's Journey
Summary of the Hero's JourneySummary of the Hero's Journey
Summary of the Hero's Journey
 
Open by Default
Open by DefaultOpen by Default
Open by Default
 
Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926
 
Linked Data ROI 20110426
Linked Data ROI 20110426Linked Data ROI 20110426
Linked Data ROI 20110426
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
 

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 

Último (20)

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 

Number Systems CPSC125

  • 1. Number Systems Spring 2010 Dr. David Hyland-Wood University of Mary Washington Monday, January 11, 2010
  • 2. Information Encoding We use encoding schemes to represent and store information. • Roman Numerals: I, IV, XL, MMIV • Acronyms: UMW, CPSC-125, SSGN-726 • Postal codes: 22401, M5W 1E6 • Musical Note Notation: Encoding schemes are only useful if the stored information can be retrieved. Monday, January 11, 2010
  • 3. Monday, January 11, 2010 Linear A has not been deciphered. This tablet stores information, but it can no longer be retrieved. Think about floppy disks, tape drives, bad handwriting and other forms of “lost” data.
  • 4. Decimal Notation • base 10 or radix 10 ... uses 10 symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 • Position represents powers of 10 • 5473 or 5473 10 (5 * 103) + (4 * 102) + (7 * 101) + (3 * 100) • 73.19 10 or 73.19 (7 * 101) + (3 * 100) + (1 * 10-1) + (9 * 10-2) Monday, January 11, 2010
  • 5. Monday, January 11, 2010 There is an obvious reason to use base 10.
  • 6. Monday, January 11, 2010 The ancient Sumerians used base 12, which is why we inherited a 12-hour clock.
  • 7. Binary Notation • base 2 ... uses only 2 symbols 0, 1 • Position represents powers of 2 • 11010 2 (1 * 24) + (1 * 23) + (0 * 22) + (1 * 21) + (0 * 20) • 10.11 2 (1 * 21) + (0 * 20) + (1 * 2-1) + (1 * 2-2) Monday, January 11, 2010
  • 8. Monday, January 11, 2010 Computers are binary all the way down. Electrical signals are “on” or “off” based on voltage. Magnetic storage systems such as hard disc drives are based on magnetism. Optical storage systems are based on depth.
  • 9. “On” or “Off” Monday, January 11, 2010 Computers are binary all the way down. Electrical signals are “on” or “off” based on voltage. Magnetic storage systems such as hard disc drives are based on magnetism. Optical storage systems are based on depth.
  • 10. “On” or “Off” voltage threshold time Monday, January 11, 2010 Computers are binary all the way down. Electrical signals are “on” or “off” based on voltage. Magnetic storage systems such as hard disc drives are based on magnetism. Optical storage systems are based on depth.
  • 11. “On” or “Off” “On” voltage threshold “Off” time Monday, January 11, 2010 Computers are binary all the way down. Electrical signals are “on” or “off” based on voltage. Magnetic storage systems such as hard disc drives are based on magnetism. Optical storage systems are based on depth.
  • 12. “On” or “Off” “On” 1 voltage threshold “Off” 0 time Monday, January 11, 2010 Computers are binary all the way down. Electrical signals are “on” or “off” based on voltage. Magnetic storage systems such as hard disc drives are based on magnetism. Optical storage systems are based on depth.
  • 13. “On” or “Off” “On” 1 True voltage threshold “Off” 0 False time Monday, January 11, 2010 Computers are binary all the way down. Electrical signals are “on” or “off” based on voltage. Magnetic storage systems such as hard disc drives are based on magnetism. Optical storage systems are based on depth.
  • 14. Octal Notation • base 8 ... uses 8 symbols 0, 1, 2, 3, 4, 5, 6, 7 • Position represents power of 8 • 1523 8 (1 * 8 3) + (5 * 8 2) + (2 * 8 1) + (3 * 8 0) • 56.72 8 (5 * 81) + (6 * 80) + (7 * 8-1) + (2 * 8-2) Monday, January 11, 2010
  • 15. Hexadecimal Notation • base 16 or ‘hex’ ... uses 16 symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F • Position represents powers of 16 • B65F or 0xB65F 16 (11 * 163) + (6 * 162) + (5 * 161) + (15 * 160) • F3.A9 16 or 0xF3.A9 (15 * 161) + (3 * 160) + (10 * 16-1) + (9 * 16-2) Monday, January 11, 2010
  • 16. Octal and Hexadecimal • Humans are accustomed to decimal • Computers use binary • So why ever use octal or hexadecimal? • Binary numbers can be long with a lot of digits • Longer number make for more confusion • Copying longer numbers allows greater chance for error • Octal represents binary in 1/3 the number of digits • Hexadecimal represents binary in 1/4 the number of digits Monday, January 11, 2010
  • 17. Base Conversion Binary to Decimal • 11010 2 • (1*2 )+(1*2 )+(0*2 )+(1*2 )+(0*2 ) 4 3 2 1 0 • 16 + 8 + 0 + 2 + 0 • 26 Monday, January 11, 2010
  • 18. Base Conversion Octal to Decimal • 1523 8 • (1*8 )+(5*8 )+(2*8 )+(3*8 ) 3 2 1 0 • 512+320+16+3 • 851 Monday, January 11, 2010
  • 19. Base Conversion Hexadecimal to Decimal • B65F 16 • (11 * 16 ) + (6 * 16 ) + (5 * 16 ) + (15 * 16 ) 3 2 1 0 • 45056+1536+80+15 • 46687 Monday, January 11, 2010
  • 20. Base Conversion Decimal to Binary • 25 / 2 = 12 R 1 (1101112) • 82310 • 12 / 2 = 6 R 0 (01101112) • 823 / 2 = 411 R1(12) • 6 / 2 = 3 R 0 (001101112) • 411 / 2 = 205 R 1 (112) • 3 / 2 = 1 R 1 (1001101112) • 205 / 2 = 102 R 1 (1112) • 1 / 2 = 0 R 1 (11001101112) • 102 / 2 = 51 R 0 (01112) • 11001101112 • 51 / 2 = 25 R 1 (101112) Monday, January 11, 2010
  • 21. Base Conversion Decimal to Octal • 823 • 823 / 8 = 102 R 7 (7 ) 8 • 102 / 8 = 12 R 6 (67 ) 8 • 12 / 8 = 1 R 4 (467 ) 8 • 1 / 8 = 0 R 1 (1467 ) 8 • 1467 8 Monday, January 11, 2010
  • 22. Base Conversion Decimal to Hexadecimal • 82310 • 250010 • 823 / 16 = 51 R 7 (716) • 2500 / 16 = 156 R 4 (416) • 51 / 16 = 3 R 3 (3716) • 156 / 16 = 9 R 12 (C416) • 3 / 16 = 0 R 3 (33716) • 9 / 16 = 0 R 9 (9C416) • 33716 • 9C416 Monday, January 11, 2010
  • 23. Base Conversion Binary to Octal Octal to Binary • 11001101112 • 14678 • (12) (1002) (1102) (1112) • (18) (48) (68) (78) • (18) (48) (68) (78) • (0012) (1002) (1102) (1112) • 14678 • 11001101112 Monday, January 11, 2010
  • 24. Base Conversion Binary to Hexadecimal to Hexadecimal Binary • 10110110010111112 • B65F16 • (10112) (01102) (01012) • (B16) (616) (516) (F16) (11112) • (10112) (01102) (01012) • (B16) (616) (516) (F16) (11112) • B65F16 • 10110110010111112 Monday, January 11, 2010
  • 25. Computing Systems • Computers were originally designed for the primary purpose of doing numerical calculations. Abacus, counting machines, calculators • We still do numerical operations, but not necessarily as a primary function. • Computers are now “information processors” and manipulate primarily nonnumeric data. Text, GUIs, sounds, information structures, pointers to data addresses, device drivers Monday, January 11, 2010
  • 26. Codes • A code is a scheme for representing information. • Computers use codes to store types of information. • Examples of codes: • Alphabet • DNA (biological coding scheme) • Musical Score • Mathematical Equations Monday, January 11, 2010
  • 27. Codes • Two Elements (always) • A group of symbols • A set of rules for interpreting these symbols • Place-Value System (common) • Information varies based on location • Notes of a musical staff • Bits in a binary number Monday, January 11, 2010
  • 28. Computers and Codes • Computers are built from two-state electronics. • Each memory location (electrical, magnetic, optic) has two states (On or Off) • Computers must represent all information using only two symbols • On (1) • Off (0) • Computers rely on binary coding schemes Monday, January 11, 2010 Quantum computing? Tertiary-state machines? Maybe, but not yet and/or not common. Probably coming, though.
  • 29. Computers and Binary • Decimal 109 • Binary 11011012 • Computer 16-bit word size 0000 0000 0110 11012 • Computer 32-bit word size 0000 0000 0000 0000 0000 0000 0110 11012 Monday, January 11, 2010 Many modern computers now use a 64-bit word size in their CPUs. 231 ~ 4 billion. 263 ~ 9.2 quintillion (~1019). Also IP address sizes (v4 and v6).
  • 30. Binary Addition • 4502 + 1234 • 1000110010110 2 + 100110100102 • 1011001101000 2 • 5736 11 1 11 10001100101102 00100110100102 10110011010002 Monday, January 11, 2010
  • 31. Negative Numbers Sign-Magnitude Format • Uses the highest order bit as a ‘sign’ bit. All other bits are used to store the absolute value (magnitude) • Negative numbers have the sign bit set • Reduces the range of values that can be stored. • -109 in 16-bit representation using a sign bit 10 1000 0000 0110 11012 Monday, January 11, 2010
  • 32. Negative Numbers One’s Complement Format • Exact opposite of the sequence for the positive value. Each bit is “complemented” or “flipped” • 109 in 16-bit representation 0000 0000 0110 11012 • -109 in 16-bit One’s Complement 1111 1111 1001 00102 • This makes mathematical operations difficult Monday, January 11, 2010
  • 33. Negative Numbers Two’s Complement Format • Add 1 to One’s Complement • 109 in 16-bit representation 0000 0000 0110 11012 • -109 in 16-bit One’s Complement 1111 1111 1001 00102 • -109 in 16-bit Two’s Complement 1111 1111 1001 00112 Monday, January 11, 2010
  • 34. Negative Numbers • -109 in 16-bit One’s Complement 1111 1111 1001 00102 • -109 in 16-bit Two’s Complement 1111 1111 1001 00102 + 0000 0000 0000 00012 1111 1111 1001 00112 Monday, January 11, 2010
  • 35. Two’s Complement Shortcut • 109 in 16-bit representation 0000 0000 0110 11012 • -109 in 16-bit Two’s Complement: • Copy everything left of the first ‘1’ including the first ‘1’ 0000 0000 0110 11012 • Complement (flip) all other bits 1111 1111 1001 00112 Monday, January 11, 2010
  • 36. Two’s Complement Shortcut • 10656 in 16-bit representation 0010 1001 1010 00002 • -10656 in 16-bit Two’s Complement: • Copy everything left of the first ‘1’ including the first ‘1’ 0010 1001 1010 00002 • Complement (flip) all other bits 1101 0110 0110 00002 Monday, January 11, 2010
  • 37. Two’s Complement Arithmetic • 4502 + (-1234) Convert to binary, 16-bit representations 450210 0001 0001 1001 01102 -123410 + 1111 1011 0010 11102 10000 1100 1100 01002 • This is 17 bits – the highest order bit simply gets dropped! 00001100110001002 = 326810 Monday, January 11, 2010
  • 38. utp ut O 01 00 11 00 1 11 00 00 00 6810 Inp ut 32 10 01 01 11 0 11 10 00 0 10 00 1 11 00 0 10 11 11 210 450 10 -1 234 Monday, January 11, 2010 Imagine that you are doing this operation in a silicon chip with only 16 pins on each side. The 17th “bit” has nowhere to go! In actuality, the input would be preceded by an “add” command.
  • 40. Credits - CC Licensed Decimal numbers on shoji http://www.flickr.com/photos/pitmanra/1184492148/ Hands http://www.flickr.com/photos/faraz27989/537051865/ Clock http://www.flickr.com/photos/zoutedrop/2317065892/ Credits - Fair Use Linear A tablet http://www.historywiz.com/images/greece/lineara.jpg T-shirt http://www.thinkgeek.com/tshirts-apparel/unisex/frustrations/5aa9/zoom/ 8086 chip http://dl.maximumpc.com/galleries/x86/8086.png Monday, January 11, 2010