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

More Related Content

PDF
Cassandra Virtual Node talk
PDF
Partitions Performance with MySQL 5.1 and 5.5
PDF
12 Bivariate
PDF
MySQL データ分割入門
PDF
Tricking out your Memcached Setup
PDF
Number Systems
PDF
Number system
Cassandra Virtual Node talk
Partitions Performance with MySQL 5.1 and 5.5
12 Bivariate
MySQL データ分割入門
Tricking out your Memcached Setup
Number Systems
Number system

Similar to Number Systems CPSC125 (20)

PPT
PPT
PDF
01 number systems-students
PPTX
04 chapter03 02_numbers_systems_student_version_fa16
DOC
Chapter 4--Data representation Method.doc
PPT
1. basic theories of information
PDF
Binary overview
PDF
silo.tips_-chapter-1-the-binary-number-system-11-why-binary.pdf
PPT
01.number systems
PPT
2. Computer_Organization_unit_ 1_win.ppt
PPT
01.number systems
PPTX
Number_systems_for _o_& _A_levels by fari
PPTX
Introduction to Computing
PPT
01.Number Systems
KEY
Binary systemn
PPTX
Number-Systems presentation of the mathematics
PDF
Binary reference guide csit vn1202
PDF
form-3-computer studies summarized NOTES.pdf
PPT
Binary numbers videos
PPS
Binary Numbers
01 number systems-students
04 chapter03 02_numbers_systems_student_version_fa16
Chapter 4--Data representation Method.doc
1. basic theories of information
Binary overview
silo.tips_-chapter-1-the-binary-number-system-11-why-binary.pdf
01.number systems
2. Computer_Organization_unit_ 1_win.ppt
01.number systems
Number_systems_for _o_& _A_levels by fari
Introduction to Computing
01.Number Systems
Binary systemn
Number-Systems presentation of the mathematics
Binary reference guide csit vn1202
form-3-computer studies summarized NOTES.pdf
Binary numbers videos
Binary Numbers
Ad

More from David Wood (20)

PPTX
Internet of Things (IoT) two-factor authentication using blockchain
PPTX
Returning to Online Privacy?
PPTX
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
PPTX
BlockSW 2019 Keynote
PDF
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
PDF
Privacy in the Smart City
PDF
Controlling Complexities in Software Development
PDF
Privacy Concerns related to Verifiable Claims
PDF
Implementing the Verifiable Claims data model
PDF
So You Wanna be a Startup CTO 20170301
PDF
Functional manipulations of large data graphs 20160601
PDF
When Metaphors Kill
PDF
Secularism in Australia
PDF
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
PDF
Building a writer's platform with social media
PDF
Summary of the Hero's Journey
PDF
Open by Default
PDF
Lod Then, Now and Next 20110926
PDF
Linked Data ROI 20110426
PDF
Introduction to Linked Data: RDF Vocabularies
Internet of Things (IoT) two-factor authentication using blockchain
Returning to Online Privacy?
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
BlockSW 2019 Keynote
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Privacy in the Smart City
Controlling Complexities in Software Development
Privacy Concerns related to Verifiable Claims
Implementing the Verifiable Claims data model
So You Wanna be a Startup CTO 20170301
Functional manipulations of large data graphs 20160601
When Metaphors Kill
Secularism in Australia
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Building a writer's platform with social media
Summary of the Hero's Journey
Open by Default
Lod Then, Now and Next 20110926
Linked Data ROI 20110426
Introduction to Linked Data: RDF Vocabularies
Ad

Recently uploaded (20)

PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PPTX
20th Century Theater, Methods, History.pptx
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
PDF
advance database management system book.pdf
PDF
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
PDF
Uderstanding digital marketing and marketing stratergie for engaging the digi...
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
AI-driven educational solutions for real-life interventions in the Philippine...
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
IGGE1 Understanding the Self1234567891011
PPTX
TNA_Presentation-1-Final(SAVE)) (1).pptx
PDF
My India Quiz Book_20210205121199924.pdf
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
HVAC Specification 2024 according to central public works department
PDF
Complications of Minimal Access-Surgery.pdf
PDF
Hazard Identification & Risk Assessment .pdf
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
20th Century Theater, Methods, History.pptx
Chinmaya Tiranga quiz Grand Finale.pdf
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
advance database management system book.pdf
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
Uderstanding digital marketing and marketing stratergie for engaging the digi...
History, Philosophy and sociology of education (1).pptx
AI-driven educational solutions for real-life interventions in the Philippine...
Practical Manual AGRO-233 Principles and Practices of Natural Farming
IGGE1 Understanding the Self1234567891011
TNA_Presentation-1-Final(SAVE)) (1).pptx
My India Quiz Book_20210205121199924.pdf
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
Weekly quiz Compilation Jan -July 25.pdf
HVAC Specification 2024 according to central public works department
Complications of Minimal Access-Surgery.pdf
Hazard Identification & Risk Assessment .pdf
MBA _Common_ 2nd year Syllabus _2021-22_.pdf

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