Bit Representation Outline

Slides:



Advertisements
Similar presentations
DATA REPRESENTATION CONVERSION.
Advertisements

Lecture - 2 Number systems and computer data formats
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Chapter Chapter Goals Know the different types of numbers Describe positional notation.
Binary Numbers.
Number Systems.
Simple Data Type Representation and conversion of numbers
Fundamentals of Python: First Programs Chapter 4: Number Systems.
CS105 INTRODUCTION TO COMPUTER CONCEPTS BINARY VALUES & NUMBER SYSTEMS Instructor: Cuong (Charlie) Pham.
Chapter 3 Representing Numbers and Text in Binary Information Technology in Theory By Pelin Aksoy and Laura DeNardis.
Numbering Systems CS208.
Based on slides by:Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. ECE/CS 352: Digital System Fundamentals Lecture 1 – Number Systems and.
Numbering Systems. CSCE 1062 Outline What is a Numbering System Review of decimal numbering system Binary representation range Hexadecimal numbering system.
Conversion of Number System Conversion Among Bases The possibilities: Hexadecimal DecimalOctal Binary
Bit Manipulation when every bit counts. Questions on Bit Manipulation l what is the motivation for bit manipulation l what is the binary, hexadecimal,
NUMBER SYSTEM.
CONVERSION OF NUMBER SYSTEMS FAHEEM ANWAR MANAGER NETWORKS ACADEMY PTCL ACADEMY.
Chapter 2 Binary Values and Number Systems. 2 2 Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645,
Number Systems Ron Christensen CIS 121.
Number System. Number Systems Important Number systems – Decimal – Binary – Hexadecimal.
Number Base Conversions
Octal to Decimal Hexadecimal DecimalOctal Binary.
Data Representation Hexadecimal  Although computers work in binary it is sometimes inconvenient for humans to read everything in Binary. For example in.
CEC 220 Digital Circuit Design Number Systems & Conversions Friday, January 9 CEC 220 Digital Circuit Design Slide 1 of 16.
NUMBER SYSTEM. Number System Number Base B => B symbols – Base 16(Hexa):0, 1,……9, A,…, E, F – Base 10 (Decimal): 0, 1, 2,……, 7, 8, 9 – Base 8(Octal):
Topic 14.1 Extended Hexadecimal  Decimal is base 10 and uses 10 digits (0,1,2,3,4,5,6,7,8,9).  Binary is base 2 and uses 2 digits (0,1).  Computers.
Number Representation Lecture Topics How are numeric data items actually stored in computer memory? How much space (memory locations) is.
Chapter 2 Binary Values and Number Systems Chapter Goals Distinguish among categories of numbers Describe positional notation Convert numbers in.
NUMBER SYSTEMS AND CODES. CS Digital LogicNumber Systems and Codes2 Outline Number systems –Number notations –Arithmetic –Base conversions –Signed.
Arithmetic Chapter 4 Subject: Digital System Year: 2009.
Number Systems. Topics  The Decimal Number System  The Binary Number System  Converting from Binary to Decimal  Converting from Decimal to Binary.
Computer Studies Today Chapter 19 1 Chapter 19. Computer Studies Today Chapter 19 2 »Information stored in a computer is in two states: –ON –OFF.
Chapter 5 NUMBER REPRESENTATION AND ARITHMETIC CIRCUITS.
Binary Values. Numbers Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative Numbers.
1 Digital Logic Design (41-135) Chapter 5 Number Representation & Arithmetic Circuits Younglok Kim Dept. of Electrical Engineering Sogang University Spring.
Number Systems Decimal Can you write 12,045 in expanded form? Base? Allowable digits for each place?
Prepared By: Norakmar Binti Mohd Nadzari CHAPTER 2 ARITHMETIC AND LOGIC UNIT.
WHAT IS BINARY? Binary is a number system that only uses two digits: 1 and 0. Any information that processed by a computer it is put into sequence of.
Topic: Binary Encoding – Part 1
Octal to Decimal Decimal Octal Binary Hexadecimal.
COMPUTER ORGANIZATION
Integer Real Numbers Character Boolean Memory Address CPU Data Types
EPSII 59:006 Spring 2004.
Base ‘b’ number for i = 0 to n – 1 for an n digit quantity
CSE 102 Introduction to Computer Engineering
Chapter 3 Data Representation
Binary Quiz UIN: ____________________
Number Systems Base 2, 10, 16.
Principles of Computing – UFCFA Lecture-3
Unit 2.6 Data Representation Lesson 1 ‒ Numbers
Binary Lesson 3 Hexadecimal
Binary Lesson 8a IPv6 Addresses: Hexadecimal
Digital Electronics and Microprocessors
There are 10 types of people of people in this world…
CSE 113 A January 12 – 16, 2009.
Binary Lesson 3 Hexadecimal
Binary Lesson 3 Hexadecimal
Binary Lesson 8 IPv6 Addresses: Hexadecimal
Binary Lesson 3 Hexadecimal
AP Computer Science LESSON 1 on Number Bases.
January 12 – 16, 2009 CSE 113 B.
Chapter 2 Number Systems.
Chapter 2 Number Systems.
Binary Lesson 4 Hexadecimal and Binary Practice
Chapter 2 Number Systems.
Remember the 10 types of people of people in this world…
COMS 161 Introduction to Computing
Computer Science 1 Review and finish Number base conversion
Chapter 2 Number Systems.
Presentation transcript:

Bit Representation Outline How Are Integers Represented in Memory? Decimal Number Representation (Base 10) Decimal (Base 10) Breakdown Nonal Number Representation (Base 9) Nonal (Base 9) Breakdown Octal Number Representation (Base 8) Octal (Base 8) Breakdown Trinary Number Representation (Base 3) Trinary (Base 3) Breakdown Binary Number Representation (Base 2) Binary (Base 2) Breakdown & Conversion Counting in Decimal (Base 10) Counting in Nonal (Base 9) Counting in Octal (Base 8) Counting in Trinary (Base 3) Counting in Binary (Base 2) Counting in Binary (Base 2) w/Leading 0s Adding Integers #1 Adding Integers #2 Binary Representation of int Values Bit Representation Lesson CS1313 Spring 2009

How Are Integers Represented in Memory? In computers, all data are represented as contiguous sequences of bits. An integer is represented as a sequence of 8, 16, 32 or 64 bits. For example: What does this mean??? 1 97 = Bit Representation Lesson CS1313 Spring 2009

Decimal Number Representation (Base 10) In the decimal number system (base 10), we have 10 digits: 0 1 2 3 4 5 6 7 8 9 We refer to these as the Arabic digits. For details, see http://www.mediahistory.umn.edu/archive/numerals.html Bit Representation Lesson CS1313 Spring 2009

Decimal (Base 10) Breakdown 472110 = 400010 + 70010 2010 110 4 . 100010 7 10010 2 1010 1 103 102 101 100 103 102 101 100 4 7 2 1 Jargon: 472110 is pronounced “four seven two one base 10,” or “four seven two one decimal.” Bit Representation Lesson CS1313 Spring 2009

Nonal Number Representation (Base 9) In the nonal number system (base 9), we have 9 digits: 0 1 2 3 4 5 6 7 8 NOTE: No one uses nonal in real life; this is just an example. Bit Representation Lesson CS1313 Spring 2009

Nonal (Base 9) Breakdown 47219 = 40009 + 7009 209 19 4 . 10009 7 1009 2 109 1 93 92 91 90 4 . 72910 + 7 8110 2 910 1 110 = 350210 So: 47219 = 350210 93 92 91 90 4 7 2 1 Jargon: 47219 is pronounced “four seven two one base 9,” or “four seven two one nonal.” Bit Representation Lesson CS1313 Spring 2009

Octal Number Representation (Base 8) In the octal number system (base 8), we have 8 digits: 0 1 2 3 4 5 6 7 NOTE: Some computer scientists used to use octal in real life, but it has mostly fallen out of favor, because it’s been supplanted by base 16 (hexadecimal). Octal does show up a little bit in C character strings, which we’ll learn about soon. Bit Representation Lesson CS1313 Spring 2009

Octal (Base 8) Breakdown 47218 = 40008 + 7008 208 18 4 . 10008 7 1008 2 108 1 83 82 81 80 4 . 51210 + 7 6410 2 810 1 110 = 251310 So: 47218 = 251310 83 82 81 80 4 7 2 1 Jargon: 47218 is pronounced “four seven two one base 8,” or “four seven two one octal.” Bit Representation Lesson CS1313 Spring 2009

Trinary Number Representation (Base 3) In the trinary number system (base 3), we have 3 digits: 0 1 2 NOTE: No one uses trinary in real life; this is just an example. Bit Representation Lesson CS1313 Spring 2009

Trinary (Base 3) Breakdown 20213 = 20003 + 03 203 13 2 . 10003 1003 103 1 33 32 31 30 2 . 2710 + 910 310 1 110 = 6110 So: 20219 = 6110 33 32 31 30 2 1 Jargon: 20213 is pronounced “two zero two one base 3,” or “two zero two one trinary.” Bit Representation Lesson CS1313 Spring 2009

Binary Number Representation (Base 2) In the binary number system (base 2), we have 2 digits: 0 1 This is the number system that computers use internally. Bit Representation Lesson CS1313 Spring 2009

Binary (Base 2) Breakdown & Conversion 011000012 = . 100000002 + 27 12810 1 10000002 26 6410 1000002 25 3210 100002 24 1610 10002 23 810 1002 22 410 102 21 210 12 = 20 110 9710 23 22 21 20 1 27 26 25 24 9710 = Bit Representation Lesson CS1313 Spring 2009

Counting in Decimal (Base 10) In base 10, we count like so: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, ... 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, Bit Representation Lesson CS1313 Spring 2009

Counting in Nonal (Base 9) In base 9, we count like so: 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, ... 81, 82, 83, 84, 85, 86, 87, 88, 100, 101, 102, 103, 104, 105, 106, 107, 108, 110, 181, 182, 183, 184, 185, 186, 187, 188, 200, 881, 882, 883, 884, 885, 886, 887, 888, 1000, Bit Representation Lesson CS1313 Spring 2009

Counting in Octal (Base 8) In base 8, we count like so: 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 23, 24, 25, 26, 27, 30, ... 71, 72, 73, 74, 75, 76, 77, 100, 101, 102, 103, 104, 105, 106, 107, 110, 171, 172, 173, 174, 175, 176, 177, 200, 771, 772, 773, 774, 775, 776, 777, 1000, Bit Representation Lesson CS1313 Spring 2009

Counting in Trinary (Base 3) In base 3, we count like so: 0, 1, 2, 10, 11, 12, 20, 21, 22, 100, 101, 102, 110, 111, 112, 120, 121, 122, 200, 201, 202, 210, 211, 212, 220, 221, 222, 1000, ... Bit Representation Lesson CS1313 Spring 2009

Counting in Binary (Base 2) In base 2, we count like so: 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111 10000, ... Bit Representation Lesson CS1313 Spring 2009

Counting in Binary (Base 2) w/Leading 0s In base 2, we sometimes like to put in leading zeros: 00000000, 00000001, 00000010, 00000011, 00000100, 00000101, 00000110, 00000111, 00001000, 00001001, 00001010, 00001011, 00001100, 00001101, 00001110, 00001111 00010000, ... Bit Representation Lesson CS1313 Spring 2009

Bit Representation Lesson Adding Integers #1 23 22 21 20 27 26 25 24 1 8 4 2 128 64 32 16 9710 = 1 + 01510 = 1 11210 = Bit Representation Lesson CS1313 Spring 2009

Bit Representation Lesson Adding Integers #2 23 22 21 20 27 26 25 24 1 8 4 2 128 64 32 16 9710 = 1 + 00610 = 1 10310 = Bit Representation Lesson CS1313 Spring 2009

Binary Representation of int Values % cat xadd.c #include <stdio.h> int main () { /* main */ int x; x = 97; printf("%d\n", x); x = x + 6; return 0; } /* main */ % gcc -o xadd xadd.c % xadd 97 103 x : ? 1 1 Bit Representation Lesson CS1313 Spring 2009