1 Week 2: Binary, Octal and Hexadecimal Numbers READING: Chapter 2.

Slides:



Advertisements
Similar presentations
Representing Numbers: Integers
Advertisements

CIS 020 Assembly Programming Chapter 02 - Numbering Systems & Data Representation © John Urrutia 2012, All Rights Reserved.5/27/20121.
James Tam Beyond base 10: Non-decimal based number system What exactly is decimal? How do other number systems work (binary, octal and hex) How to convert.
Chapter 2 Binary Values and Number Systems Chapter Goals Distinguish among categories of numbers Describe positional notation Convert numbers in.
Kavita Hatwal Fall The decimal system, also called the base 10 number system is based on ten numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. All the numbers.
Level ISA3: Information Representation
Chapter Chapter Goals Know the different types of numbers Describe positional notation.
Decimal Addition What is going on? (carry) (subtract the base)
Chapter 02 Binary Values and Number Systems Nell Dale & John Lewis.
The Binary Number System
Number Systems and Arithmetic
COE 202: Digital Logic Design Number Systems Part 1
Binary Numbers.
Number systems Converting numbers between binary, octal, decimal, hexadecimal (the easy way)
Binary and Hexadecimal Numbers
Number Systems.
(2.1) Fundamentals  Terms for magnitudes – logarithms and logarithmic graphs  Digital representations – Binary numbers – Text – Analog information 
Lecture for Week Spring.  Numbers can be represented in many ways. We are familiar with the decimal system since it is most widely used in everyday.
Numbering systems.
CS105 INTRODUCTION TO COMPUTER CONCEPTS BINARY VALUES & NUMBER SYSTEMS Instructor: Cuong (Charlie) Pham.
Number Systems Binary and Hexadecimal. Base 2 a.k.a. Binary  Binary works off of base of 2 instead of a base 10 like what we are taught in school 
Numbering Systems CS208.
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
Chapter 2 Binary Values and Number Systems Chapter Goals Distinguish among categories of numbers Describe positional notation Convert numbers in.
IT101: INFORMATION TECHNOLOGY FUNDAMENTALS 1 Edited By Dr. Ahmed Abo-Bakr Information Technology Dept. Faculty of Computers & Information.
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,
Binary Values and Number Systems Chapter Goals Distinguish among categories of numbers Describe positional notation Convert numbers in other bases.
Number systems, Operations, and Codes
Numbering System Base Conversion. Number systems Decimal – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Binary – 0, 1 Octal – 0, 1, 2, 3, 4, 5, 6, 7 Hexadecimal system.
Binary Values and Number Systems
Positional Notation 642 in base 10 positional notation is:
Number Systems Binary to Decimal Octal to Decimal Hexadecimal to Decimal Binary to Octal Binary to Hexadecimal Two’s Complement.
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
Hexadecimal. Overview Hexadecimal (hex) ~ base 16 number system Use 0 through 9 and... A = 10 B = 11 C = 12 D = 13 E = 14 F = 15.
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
Chapter 7 Section 7.2 Addition & Subtraction in Different Bases.
Binary01.ppt Decimal Decimal: Base 10 means 10 Unique numerical digits ,00010,000 Weight Positions 3,
NUMBER SYSTEMS.
RULE #1: Standard Scientific Notation is a number from 1 to 9 followed by a decimal and the remaining significant figures and an exponent of 10 to hold.
Chapter 2 Binary Values and Number Systems Chapter Goals Distinguish among categories of numbers Describe positional notation Convert numbers in.
ECE 362 Microprocessor Systems and Interfacing ©5-1 Lecture 1 Hexadecimal Computation Outline n Decimal n Binary n Octal n Hexadecimal.
©2010 Cengage Learning SLIDES FOR CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION Click the mouse to move to the next page. Use the ESC key to exit.
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
SCIENTIFIC NOTATION RULES. Rules for converting to Scientific Notation One non-zero number before the decimal One digit after the decimal If you are making.
Number Systems. Topics  The Decimal Number System  The Binary Number System  Converting from Binary to Decimal  Converting from Decimal to Binary.
Cis303a_chapt03_exam1_answer.ppt CIS303A: System Architecture Exam 1: Chapter 3 Answer List the characters (digits) for the following bases. 1) Decimal:
CSC 110 – Intro to Computing Lecture 3: Converting between bases & Arithmetic in other bases.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Binary Values. Numbers Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative Numbers.
Dr. ClincyLecture 2 Slide 1 CS Chapter 2 (1 of 5) Dr. Clincy Professor of CS Note: Do not study chapter 2’s appendix (the topics will be covered.
Prepared By: Norakmar Binti Mohd Nadzari CHAPTER 2 ARITHMETIC AND LOGIC UNIT.
Binary Values and Number Systems
Unit 1 Introduction Number Systems and Conversion.
Introduction To Number Systems
Digital Design Chapter One Digital Systems and Binary Numbers
Chapter 02 Nell Dale & John Lewis.
Lecture 3: Binary values and number systems
COMPUTING FUNDAMENTALS
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
Binary Quiz UIN: ____________________
MMNSS COLLEGE,KOTTIYAM DEPARTMENT OF PHYSICS
Digital Electronics and Microprocessors
Binary Values and Number Systems
ECE 301 – Digital Electronics
Chapter Four Data Representation in Computers By Bezawit E.
Binary Values and Number Systems
Number systems Converting numbers between binary, octal, decimal, hexadecimal (the easy way)
COE 202: Digital Logic Design Number Systems Part 2
Presentation transcript:

1 Week 2: Binary, Octal and Hexadecimal Numbers READING: Chapter 2

2 2 Positional Notation: Base Quick Re-cap: 1. Conversion from other bases to base 10, where b is the base of the original number, d i is the digit at the i-th position : 2. Conversion from base 10 to other bases EECS Computer Use: Fundamentals d n-1 * b n-1 + … + d 2 * b 2 + d 1 * b 1 + d 0 * b 0 Step 1: Always divide the decimal number by the new base, write down the quotient and the reminder Step 2: Divide the quotient by the new base, write down the new quotient and the new reminder Step 3: Repeat step 2 until the quotient is 0

3 3 Positional Notation: Base In general, we can convert numbers in any bases with the following method: EECS Computer Use: Fundamentals (number) A (number) 10 (number) B where A ≠ B ≠ 10

4 4 Positional Notation: Adding binary numbers Basic idea in adding digits in decimal: = 3, = 5…. EECS Computer Use: Fundamentals When you try to add two numbers whose sum is equal to or greater than the base value (i.e. 10), we reuse the same digits and rely on position. The rules of adding binary numbers are similar, but we run out of digits much faster (since we only have 2 digits) is carried into the next position to the left 1 is called the “carry bit”

5 5 Positional Notation: Adding binary numbers Example 1: what is the sum of the following two binary numbers? EECS Computer Use: Fundamentals We can confirm that the above sum is correct by converting each of the above binary numbers to their decimal representations

6 6 Positional Notation: Adding binary numbers EECS Computer Use: Fundamentals convert to base 10 1* *2 0 = convert to base 10 1* *2 0 = 9 1* *2 2 = 12

7 7 Positional Notation: Adding binary numbers Example 2: what is the sum of the following two binary numbers? EECS Computer Use: Fundamentals convert to base 10 1* * *2 0 = = convert to base 10 1* * *2 0 = = 13 1* *2 2 = 16+4 = 20

8 8 Positional Notation: Power-of-2 number systems EECS Computer Use: Fundamentals Decimal (base 10)Binary (base 2)Octal (base 8)

9 9 Positional Notation: Power-of-2 number systems An unique relationship between binary and octal numbers, as 8 is a power of 2 (i.e. 8 = 2 3 ) Given an octal number, you can convert it directly to binary by replacing each digit in the octal number with the binary representation of that digit (note: the largest digit can only be “7”) EECS Computer Use: Fundamentals DecimalBinaryOctal

10 Positional Notation: Power-of-2 number systems EECS Computer Use: Fundamentals Example: what is the binary representation of the octal “154” ? binary octal

11 Positional Notation: Power-of-2 number systems Now, if we convert the binary number to base 10: EECS Computer Use: Fundamentals We got 108, same as the number we got when we converted the octal number “154” to its base 10 representation: d n-1 * b n-1 + … + d 2 * b 2 + d 1 * b 1 + d 0 * b 0 1 * * * 8 0 = = * * * * 2 2 = = = 108

12 Positional Notation: Power-of-2 number systems Convert from binary number to octal number: EECS Computer Use: Fundamentals Step 1: start at the rightmost binary digit and mark the digits in groups of threes Step 2: convert each group of three into its octal value Note: Add 0s to the front if the leftmost group does not have 3 binary digits Example: what is the octal representation of the binary number: ? Note: any digits > 7 do not exist in octal, if you get an octal value > 7, something is wrong binary octal

13 Positional Notation: Power-of-2 number systems 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Recall that, in base-16, we have: EECS Computer Use: Fundamentals The previous “grouping” method can be applied to convert a binary number to its hexadecimal number (since 16 = 2 4 ) 0000, ……………………………………….., 1111binary hexadecimal

14 Positional Notation: Power-of-2 number systems Convert from binary number to hexadecimal number: EECS Computer Use: Fundamentals Step 1: start at the rightmost binary digit and mark the digits in groups of fours Step 2: convert each group of four into its hexadecimal value Note: Add 0s to the front if the leftmost group does not have 4 binary digits Example: what is the octal representation of the binary number: ? E binary hexadecimal

15 Positional Notation: Power-of-2 number systems Conversion between octal and hexadecimal numbers are much easier now as we can utilize the intermediate binary digits “grouping” method EECS Computer Use: Fundamentals Example: what is the hexadecimal representation of the octal number: 4567 ? octal binary hexadecimal 9 7 7

16 Positional Notation: Adding octal numbers EECS Computer Use: Fundamentals When you try to add two numbers whose sum is equal to or greater than the base value (i.e. 8), we reuse the same digits and rely on position. (7) 8 + (1) 8 (1 0) 8 1 is carried into the next position to the left Example 1: what is the sum of the following two octal numbers? (27) 8 + (35) 8 (64) 8

17 Positional Notation: Adding octal numbers EECS Computer Use: Fundamentals (27) 8 (35) 8 convert to base 10 2* *8 0 = 16+7 = 23 (64) 8 convert to base 10 3* *8 0 = 24+5 = 29 6* *8 0 = 48+4 = 52

18 Positional Notation: Adding hexadecimal numbers EECS Computer Use: Fundamentals Same concept is applied to adding two hexadecimal numbers. When you try to add two hex numbers whose sum is equal to or greater than the base value (i.e. 16), we reuse the same digits and rely on position. (F) 16 + (1) 16 (1 0) 16 1 is carried into the next position to the left (F) 16 + (2) 16 (1 1) 16 (F) 16 + (3) 16 (1 2) 16 (F) 16 + (4) 16 (1 3) 16 and so on…..

19 Positional Notation: Adding hexadecimal numbers EECS Computer Use: Fundamentals Example: (2F) 16 + (73) 16 (A2) 16 (2F) 16 (73) 16 convert to base 10 2* *16 0 = = 47 (A2) 16 convert to base 10 7* *16 0 = = * *16 0 = = 162

20 Positional Notation: Subtracting two base 10 numbers EECS Computer Use: Fundamentals When you try to subtract a larger digit from a smaller one, we have to “borrow one” from the next left digit of the number from which you are subtracting. More precisely, we borrow one power of the base, such as in base 10, we borrow Borrow “10” from 5, so we have = 4 Example:

21 Positional Notation: Subtracting two binary numbers EECS Computer Use: Fundamentals In base 2, when borrow one power of the base to do subtraction, we borrow 2. In fact, we only need to borrow a 2 when we subtract 0 from Example: 0111 (1101) 2 (0110) 2 convert to base (0111) 2 convert to base

22 Positional Notation: Subtracting two octal numbers EECS Computer Use: Fundamentals In base 8, when borrow one power of the base to do subtraction, we borrow 8. (153) 8 - (67) 8 Example: (64) 8 (153) 8 (67) 8 convert to base (64) 8 convert to base

23 Positional Notation: Subtracting two hex numbers EECS Computer Use: Fundamentals In base 16, when borrow one power of the base to do subtraction, we borrow 16. (153) 16 - (67) 16 Example: (EC) 16 (153) 16 (67) 16 convert to base (EC) 16 convert to base