Number Bases LESSON TWO. Computer Science. By John Owen

Similar documents
CS & IT Conversions. Magnitude 10,000 1,

17. [Exploring Numbers]

FLIPPED CLASS F#3- Number System. Department of CSE, Coimbatore CTPS 2018

CHAPTER 2 Number Systems

Objective 1.02 Understand Numbering Systems

2 Number Systems 2.1. Foundations of Computer Science Cengage Learning

Mastering Binary Math

MACHINE LEVEL REPRESENTATION OF DATA

NUMERIC SYSTEMS USED IN NETWORKING

Number representations

Introduction to Computer Science-103. Midterm

Place Value. Unit 1 Lesson 1

COMP Overview of Tutorial #2

Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal

Octal & Hexadecimal Number Systems. Digital Electronics

Number systems and binary

Conversion Between Number Bases

1.3 Systems of numeration: To represent quantities in the different systems of numeration, specific symbols are used, which are also called ciphers.

Decimal/Hexadecimal Conversion

BSC & BIT Numbering Systems. ITU Lecture 3b

Chapter 2 Exercises and Answers

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

4 + 4 = = 1 5 x 2 = 10

Machine Architecture and Number Systems

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems

ITEC 1011 Introduction to Information Technologies

Numbers!!...is that right? CSCI 255

Lecture 1: Digital Systems and Number Systems

Moodle WILLINGDON COLLEGE SANGLI. ELECTRONICS (B. Sc.-I) Introduction to Number System

MATH 104B OCTAL, BINARY, AND HEXADECIMALS NUMBERS

Subtraction Understand Subtraction on a Number Line Using a number line let s demonstrate the subtraction process using the problem 7 5.

Machine Architecture and Number Systems CMSC104. Von Neumann Machine. Major Computer Components. Schematic Diagram of a Computer. First Computer?

Lesson 1: THE DECIMAL SYSTEM

Common Number Systems

Colour and Number Representation. From Hex to Binary and Back. Colour and Number Representation. Colour and Number Representation

Summer 2013 Modules 9-13

Slide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

Binary, Hexadecimal and Octal number system

How to convert a numeric value into English words in Excel

TOPICS. Other Number Systems. Other Number Systems 9/9/2017. Octal Hexadecimal Number conversion

T02 Tutorial Slides for Week 2

REPRESENTING INFORMATION:

Informatics 1 - Computation & Logic: Tutorial 3

MATH LEVEL 2 LESSON PLAN 5 DECIMAL FRACTIONS Copyright Vinay Agarwala, Checked: 1/22/18

Lecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee

Real Numbers finite subset real numbers floating point numbers Scientific Notation fixed point numbers

COE 202- Digital Logic. Number Systems II. Dr. Abdulaziz Y. Barnawi COE Department KFUPM. January 23, Abdulaziz Barnawi. COE 202 Logic Design

Computer Number Systems Supplement

THE LOGIC OF COMPOUND STATEMENTS

Lecture (01) Introduction Number Systems and Conversion (1)

Chapter 3: Number Systems and Codes. Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc.

Numeral Systems. -Numeral System -Positional systems -Decimal -Binary -Octal. Subjects:

A complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation

Chapter 3 DATA REPRESENTATION

Appendix 2 Number Representations

CMPE223/CMSE222 Digital Logic Design. Positional representation

Beyond Base 10: Non-decimal Based Number Systems

What Is It? Instruction Register Address Register Data Register

1.1 Review of Place Value

Digital Systems. John SUM Institute of Technology Management National Chung Hsing University Taichung, ROC. December 6, 2012

In this lesson, we will use the order of operations to evaluate and simplify expressions that contain numbers and variables.

Switching Circuits and Logic Design Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Converting between Percents, Decimals, and Fractions

CS/EE1012 INTRODUCTION TO COMPUTER ENGINEERING SPRING 2013 HOMEWORK I. Solve all homework and exam problems as shown in class and sample solutions

College of Computer and Information Sciences Department of Computer Science. CSC 220: Computer Organization. Unit1 Number Systems

Beyond Base 10: Non-decimal Based Number Systems

Step Octal Number Binary Number Step Step

Number Systems MA1S1. Tristan McLoughlin. November 27, 2013

Chapter 1 Preliminaries

The School District of Palm Beach County Kindergarten Mathematics Scope st Trimester

1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Digital Systems COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals

Octal and Hexadecimal Integers

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

Slide Set 1. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Chapter 3 Basic Data Types. Lecture 3 1

Numeral system Numerals

Decimal/Binary Conversion on the Soroban

Excerpt from "Art of Problem Solving Volume 1: the Basics" 2014 AoPS Inc.

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012

Chapter 2 Bits, Data Types, and Operations

Birkbeck (University of London) Department of Computer Science and Information Systems. Introduction to Computer Systems (BUCI008H4)

Parent s Guide to GO Math! Technology Correlation

Python Numbers. Learning Outcomes 9/19/2012. CMSC 201 Fall 2012 Instructor: John Park Lecture Section 01 Discussion Sections 02-08, 16, 17

Digital codes. Resources and methods for learning about these subjects (list a few here, in preparation for your research):

CHW 261: Logic Design

Decimal Binary Conversion Decimal Binary Place Value = 13 (Base 10) becomes = 1101 (Base 2).

NUMBER SYSTEMS AND CODES

CSCI 2212: Intermediate Programming / C Chapter 15

The. Binary. Number System

Binary. Hexadecimal BINARY CODED DECIMAL

Outline. What Digit? => Number System. Decimal (base 10) Significant Digits. Lect 03 Number System, Gates, Boolean Algebra. CS221: Digital Design

Numbers and Representations

1.1 Numbers system :-

Review of Data Representation & Binary Operations Dhananjai M. Rao CSA Department Miami University

UNIT 2 NUMBER SYSTEM AND PROGRAMMING LANGUAGES

MC1601 Computer Organization

Fractions Decimals Percents

Transcription:

Number Bases LESSON TWO By John Owen Computer Science

Objective In the last lesson you learned about different Number Bases used by the computer, which were Base Two binary Base Eight octal Base Sixteen hexadecimal 2

Base Conversion You also learned how to convert from the decimal (base ten) system to each of the new bases binary, octal, and hexadecimal. 3

Other conversions Now you will learn other conversions among these four number systems, specifically: Binary to Decimal Octal to Decimal Hexadecimal to Decimal 4

As well as Binary to Octal Octal to Binary Binary to Hexadecimal Hexadecimal to Binary Other conversions 5

And finally Octal to Hexadecimal Hexadecimal to Octal Other conversions 6

Binary to Decimal Each binary digit in a binary number has a place value. In the number 111, base 2, the digit farthest to the right is in the ones place, like the base ten system, and is worth 1. Technically this is the 2 0 place. 7

Binary to Decimal The 2 nd digit from the right, 111, is in the twos place, which could be called the base place, and is worth 2. Technically this is the 2 1 place. In base ten, this would be the tens place and would be worth 10. 8

Binary to Decimal The 3 rd digit from the right, 111, is in the fours place, or the base squared place, and is worth 4. Technically this is the 2 2 place. In base ten, this would be the hundreds place and would be worth 100. 9

Binary to Decimal The total value of this binary number, 111, is 4+2+1, or seven. In base ten, 111 would be worth 100 + 10 + 1, or one-hundred eleven. 10

Binary to Decimal Can you figure the decimal values for these binary values? See the answers on the next slide. 11 101 110 1111 11011 11

Here are the answers: 11 is 3 in base ten 101 is 5 110 is 6 1111 is 15 11011 is 27 Binary to Decimal 12

Octal to Decimal Octal digits have place values based on the value 8. In the number 111, base 8, the digit farthest to the right is in the ones place and is worth 1. Technically this is the 8 0 place. 13

Octal to Decimal The 2 nd digit from the right, 111, is in the eights place, the base place, and is worth 8. Technically this is the 8 1 place. 14

Octal to Decimal The 3 rd digit from the right, 111, is in the sixtyfours place, the base squared place, and is worth 64. Technically this is the 8 2 place. 15

Octal to Decimal The total value of this octal number, 111, is 64+8+1, or seventy-three. 16

Octal to Decimal Can you calculate the base 10 value for these octal values? 21 156 270 1164 2105 17

Here are the answers: 21 is 17 in base 10 156 is 110 270 is 184 1164 is 628 2105 is 1093 Octal to Decimal 18

Hexadecimal to Decimal Hexadecimal digits have place values base on the value 16. In the number 111, base 16, the digit farthest to the right is in the ones place and is worth 1. Technically this is the 16 0 place. 19

Hexadecimal to Decimal The 2 nd digit from the right, 111, is in the sixteens place, the base place, and is worth 16. Technically this is the 16 1 place. 20

Hexadecimal to Decimal The 3 rd digit from the right, 111, is in the two hundred fifty-six place, the base squared place, and is worth 256. Technically this is the 16 2 place. 21

Hexadecimal to Decimal The total value of this hexadecimal number, 111, is 256+16+1, or two hundred seventy-three. 22

Hexadecimal to Decimal Can you figure the decimal equivalents for these hexadecimal values? 2A 15F A7C 11BE A10D 23

Here are the answers: 2A is 42 in base 10 15F is 351 A7C is 2684 11BE is 4542 A10D is 41229 Hexadecimal to Decimal 24

Binary to Octal The conversion between binary and octal is quite simple. Since 2 to the power of 3 equals 8, it takes 3 base 2 digits to combine to make a base 8 digit. 25

000 base 2 equals 0 base 8 001 2 = 1 8 010 2 = 2 8 011 2 = 3 8 100 2 = 4 8 101 2 = 5 8 110 2 = 6 8 111 2 = 7 8 Binary to Octal 26

Binary to Octal What if you have more than three binary digits, like 110011? Just separate the digits into groups of three from the right, then convert each group into the corresponding base 8 digit. 110 011 base 2 = 63 base 8 27

Try these: 111100 100101 111001 1100101 left: Binary to Octal Hint: when the leftmost group has fewer than three digits, fill with zeroes from the 1100101 = 1 100 101 = 001 100 101 110011101 28

The answers are: 111100 2 = 74 8 100101 2 = 45 8 111001 2 = 71 8 1100101 2 = 145 8 110011101 2 = 635 8 Binary to Octal 29

Binary to Hexadecimal The conversion between binary and hexadecimal is equally simple. Since 2 to the power of 4 equals 16, it takes 4 base 2 digits to combine to make a base 16 digit. 30

Binary to Hexadecimal 0000 base 2 equals 0 base 8 0001 2 = 1 16 0010 2 = 2 16 0011 2 = 3 16 0100 2 = 4 16 0101 2 = 5 16 0110 2 = 6 16 0111 2 = 7 16 1000 2 = 8 16 1001 2 = 9 16 1010 2 = A 16 1011 2 = B 16 1100 2 = C 16 1101 2 = D 16 1110 2 = E 16 111 2 = F 16 31

Binary to Hexadecimal If you have more than four binary digits, like 11010111, again separate the digits into groups of four from the right, then convert each group into the corresponding base 16 digit. 1101 0111 base 2 = D7 base 16 32

Try these: 11011100 10110101 10011001 110110101 Binary to Hexadecimal Hint: when the leftmost group has fewer than four digits, fill with zeroes on the left: 110110101 = 1 1011 0101 = 0001 1011 0101 1101001011101 33

Binary to Hexadecimal The answers are: 11011100 2 = DC 16 10110101 2 = B5 16 10011001 2 = 99 16 110110101 2 = 1B5 16 1 1010 0101 1101 2 = 1A5D 16 34

Octal to Binary Converting from Octal to Binary is just the inverse of Binary to Octal. For each octal digit, translate it into the equivalent three-digit binary group. For example, 45 base 8 equals 100 101 base 2 35

Hexadecimal to Binary Converting from Hexadecimal to Binary is the inverse of Binary to Hexadecimal. For each hex digit, translate it into the equivalent four-digit binary group. For example, 45 base 16 equals 0100 0101 base 2 36

Octal and Hexadecimal to Binary Exercises Convert each of these to binary: 63 8 123 16 75 8 A2D 16 21 8 3FF 16 37

Octal and Hexadecimal to Binary Exercises The answers are: 63 8 = 110011 2 123 16 = 100100011 2 (drop leading 0s) 75 8 = 111101 2 A2D 16 = 110000101101 2 21 8 = 10001 2 3FF 16 = 1111111111 2 38

Hexadecimal to Octal Converting from Hexadecimal to Octal is a threestep process. First convert from hex to binary Regroup the bits from groups of four into groups of three. Then convert to an octal number. 39

For example: 4A3 16 = 0100 1010 0011 2 = 010 010 100 011 2 = 2243 8 Hexadecimal to Octal 40

Octal to Hexadecimal Converting from Octal to Hexadecimal is a similar three-step process. First convert from octal to binary Regroup the bits from groups of three into groups of four. Then convert to an hex number. 41

For example: 371 8 = 011 111 001 2 = 1111 1001 2 = F9 8 Hexadecimal to Octal 42

Octal/Hexadecimal Practice Convert each of these: 63 8 = 16 123 16 = 8 75 8 = 16 A2D 16 = 8 21 8 = 16 3FF 16 = 8 43

The answers are 63 8 = 33 16 123 16 = 443 8 75 8 = 3D 16 A2D 16 = 5055 8 21 8 = 11 16 3FF 16 = 1777 8 Octal/Hexadecimal Practice 44

Number Base Conversion Summary Now you know twelve different number base conversions among the four different bases (2,8,10, and 16) With practice you will be able to do these quickly and accurately, to the point of doing many of them in your head! 45

Practice Now it is time to practice. Go to the Number Base Exercises to find some excellent practice problems. Good luck and have fun! 46