Counting in Different Number Systems

Similar documents
MATH Dr. Halimah Alshehri Dr. Halimah Alshehri

Computer Number Systems

14:332:231 DIGITAL LOGIC DESIGN. Why Binary Number System?

ENGIN 112 Intro to Electrical and Computer Engineering

Menu. Review of Number Systems EEL3701 EEL3701. Math. Review of number systems >Binary math >Signed number systems

Conversions between Decimal and Binary

CHAPTER 2 NUMBER SYSTEMS

CISC 1400 Discrete Structures

EE260: Digital Design, Spring n Digital Computers. n Number Systems. n Representations. n Conversions. n Arithmetic Operations.

Binary addition example worked out

Number Theory: Representations of Integers

ENGIN 112 Intro to Electrical and Computer Engineering

We say that the base of the decimal number system is ten, represented by the symbol

CS1800 Discrete Structures Fall 2017 October, CS1800 Discrete Structures Midterm Version A

1 Computing System 2. 2 Data Representation Number Systems 22

ECE380 Digital Logic. Positional representation

Numbering Systems. Contents: Binary & Decimal. Converting From: B D, D B. Arithmetic operation on Binary.

Week No. 06: Numbering Systems

CSEN102 Introduction to Computer Science

24 = 5x. 4.8 = x. December 13, 2017

Four Important Number Systems

Chapter 1 CSCI

ALGEBRA+NUMBER THEORY +COMBINATORICS

hexadecimal-to-decimal conversion

Hakim Weatherspoon CS 3410 Computer Science Cornell University

12/31/2010. Digital Operations and Computations Course Notes. 01-Number Systems Text: Unit 1. Overview. What is a Digital System?

THE LOGIC OF COMPOUND STATEMENTS

Number Bases. Ioan Despi. University of New England. August 4, 2013

Pre-Algebra Unit 2. Rational & Irrational Numbers. Name

Numbers and Arithmetic

CSE 20 DISCRETE MATH. Winter

Introduction CSE 541

Review for Test 1 : Ch1 5

LAMC Intermediate I & II October 12, Oleg Gleizer. Warm-up

CPE100: Digital Logic Design I

Logic Simplification. Boolean Simplification Example. Applying Boolean Identities F = A B C + A B C + A BC + ABC. Karnaugh Maps 2/10/2009 COMP370 1

Chapter 9 - Number Systems

Trinity Web Site Design. Today we will learn about the technology of numbering systems.

CSE 241 Digital Systems Spring 2013

of Digital Electronics

0,..., r 1 = digits in radix r number system, that is 0 d i r 1 where m i n 1

Indices Learning Outcomes

NUMBERS AND CODES CHAPTER Numbers

Numbers and Arithmetic

CSE 20 DISCRETE MATH. Fall

Chapter 2 (Part 3): The Fundamentals: Algorithms, the Integers & Matrices. Integers & Algorithms (2.5)

Chapter 2 Linear Equations and Inequalities in One Variable

EQ: How do I convert between standard form and scientific notation?

Number Systems III MA1S1. Tristan McLoughlin. December 4, 2013

S C F F F T T F T T S C B F F F F F T F T F F T T T F F T F T T T F T T T

Wheels Radius / Distance Traveled

CS1800 Discrete Structures Final Version A

Number System conversions

Park Forest Math Team. Meet #3. Number Theory. Self-study Packet

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 2 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

MATH for SCIENCE Scientific Notation ~ Lesson Plan

Additive Numbering Systems and Numbers of Different Bases MAT 142 RSCC Scott Surgent

Chapter 1. Binary Systems 1-1. Outline. ! Introductions. ! Number Base Conversions. ! Binary Arithmetic. ! Binary Codes. ! Binary Elements 1-2

CpE358/CS381. Switching Theory and Logical Design. Summer

CSE 20: Discrete Mathematics

Section 4.2. Place-Value or Positional- Value Numeration Systems. Copyright 2013, 2010, 2007, Pearson, Education, Inc.

How long is the arrow?

Midterm Examination # 1 Wednesday, February 25, Duration of examination: 75 minutes

ECE260: Fundamentals of Computer Engineering

Exponents, Radicals, and Scientific Notation

6-3 Solving Systems by Elimination

Physics 310 Lecture 10 Microprocessors

CSCI 255. S i g n e d N u m s / S h i f t i n g / A r i t h m e t i c O p s.

Complement Arithmetic

Section 3-4: Least Common Multiple and Greatest Common Factor

Lesson/Unit Plan Name: Using Multiple Methods to Perform Operations with Scientific Notation

Foundations 5 Curriculum Guide

Cs302 Quiz for MID TERM Exam Solved

UNIVERSITI TENAGA NASIONAL. College of Information Technology

ENG2410 Digital Design Introduction to Digital Systems. Fall 2017 S. Areibi School of Engineering University of Guelph

2.3 Solving Equations Containing Fractions and Decimals

Scientific Notation. Chemistry Honors

Building a Computer Adder

Warm Up. Fourth Grade Released Test Question: 1) Which of the following has the greatest value? 2) Write the following numbers in expanded form: 25:

What are binary numbers and why do we use them? BINARY NUMBERS. Converting decimal numbers to binary numbers

+ 37,500. Discuss with your group how do you THINK you would represent 40 degrees below 0 as an integer?

Combinational Logic Design Arithmetic Functions and Circuits

Digital Systems Overview. Unit 1 Numbering Systems. Why Digital Systems? Levels of Design Abstraction. Dissecting Decimal Numbers

Number System. Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary

2.5 정수와알고리즘 (Integers and Algorithms)

Introduction to digital systems. Juan P Bello

Base-b representations of integers. (b 진법표현 ) Algorithms for computer arithmetic: Euclidean algorithm for finding GCD s.

What Fun! It's Practice with Scientific Notation!

Mat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013

Prerequisites. Introduction CHAPTER OUTLINE

Chemistry 320 Approx. Time: 45 min

COMBINATIONAL LOGIC FUNCTIONS

Student Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd()

Students should be able to (a) produce a truth table from a given logic diagram

8.4 Scientific Notation

Intermediate Math Circles February 14, 2018 Contest Prep: Number Theory

Exponents. Reteach. Write each expression in exponential form (0.4)

Digital Electronics Part 1: Binary Logic

3 Organizing Data. What is scientific notation? How are precision and accuracy different? How do scientists use graphs to show data?

Math From Scratch Lesson 29: Decimal Representation

Transcription:

Counting in Different Number Systems Base 1 (Decimal) is important because that is the base that we first learn in our culture. Base 2 (Binary) is important because that is the base used for computer codes and instructions. To understand how a computer thinks, you must think in binary. Bases 8 (Octal) and 16 (Hexadecimal) are important because they are easier to convert to binary than is decimal (because they are powers of 2) and because they suffer fewer typo-type errors than binary (because the same value requires fewer digits to copy and manipulate than in binary). Today computer programmers talk decimal, work hex and think binary. Talk Decimal Think Binary Work Octal Work Hexadecimal 1 Distinct Digits 2 Distinct Digits 8 Distinct Digits 16 Distinct Digits Calc Groups of 1 Calc Groups of 2 Calc Groups of 8 Calc Groups of 16 1 1 1 2 1 2 2 3 11 3 3 4 1 4 4 5 11 5 5 6 11 6 6 7 111 7 7 1X = 1 Group of 1 Groups of Power of 2 1X = 1 Group of 8 1X = 1 Group of 16 8 1 1 8 9 1 11 9 1 1 12 A 111 13 B 12 1 14 C 13 11 15 D 14 11 16 E 15 111 17 F Number Systems by Gerry Donaldson Page 1 of 6 December 2, 27

The position of a digit determines its magnitude == multiply by some power of the base. Talk Decimal Think Binary Work Octal Work Hexadecimal 1 Distinct Digits 2 Distinct Digits 8 Distinct Digits 16 Distinct Digits Calc Groups of 1 Calc Groups of 2 Calc Groups of 8 Calc Groups of 16 x 1 1 1 x 1 2 x 1 3 1 1 x 1 4 x 1 5 1 x 1 6 1 x 1 7 1 1 1 x 1 1 1 2 2 3 3 4 4 5 5 6 6 7 7 1X = 1 Group of 1 Groups of Power of 2 1X = 1 Group of 8 1X = 1 Group of 16 8 ( x 1 + 8 x 1 ) 1 = 8 + ( 1 x 8 + x 8 ) 8 ( x 16 + 8 x 16 ) 9 ( x 1 + 9 x 1 ) 1 11 = 8 + 1 ( 1 x 8 + 1 x 8 ) 9 ( x 16 + 8 x 16 ) 1 ( 1 x 1 + x 1 ) 12 = 8 + 2 ( 1 x 8 + 2 x 8 ) A = 1 1 ( x 16 + 1 x 16 ) 11 ( 1 x 1 + 1 x 1 ) 1 1 13 = 8 + 3 ( 1 x 8 + 3 x 8 ) B = 11 1 ( x 16 + 11 x 16 ) 12 ( 1 x 1 + 2 x 1 ) 1 14 = 8 + 4 ( 1 x 8 + 4 x 8 ) C =12 1 ( x 16 + 12 x 16 ) 13 ( 1 x 1 + 3 x 1 ) 1 1 15 = 8 + 5 ( 1 x 8 + 5 x 8 ) D = 13 1 ( x 16 + 13 x 16 ) 14 ( 1 x 1 + 4 x 1 ) 1 1 16 = 8 + 6 ( 1 x 8 + 6 x 8 ) E = 14 1 ( x 16 + 14 x 16 ) 15 ( 1 x 1 + 5 x 1 ) 1 1 1 1 17 = 8 + 7 ( 1 x 8 + 7 x 8 ) F = 15 1 ( x 16 + 15 x 16 ) Number Systems by Gerry Donaldson Page 2 of 6 December 2, 27

Converting Other Bases To Decimal The position of a digit determines its magnitude == multiply by some power of the base. [ Remember: Any value to the power of zero is equal to the value of one. X = 1 ] 27351 = 2 x 1 + 7 x 1 + 3 x 1 + 5 x 1 = 2 x 1 + 7 x 1 + 3 x 1 + 5 x 1 = 2 + 7 + 3 + 5 = 2,735 1 3 2 27358 = 2 x 8 + 7 x 8 + 3 x 8 + 5 x 8 = 2 x 512 + 7 x 64 + 3 x 8 + 5 x 1 = 124 + 448 + 24 + 5 = 1,51 1 3 2 273516 = 2 x 16 + 7 x 16 + 3 x 16 + 5 x 16 = 2 x 65,536 + 7 x 256 + 3 x 16 + 5 x 1 = 131,72 + 1,792 + 48 + 5 = 132,917 1 3 2 27352 = ILLEGAL because base 2 only has the digits zero and one [ and 1 ] 2 or 7 or 3 or 5!! <><><><><><><><><><><><><><><><><><><><><> 1111 = 1 x 1 + x 1 + 1 x 1 + 1 x 1 = 1 x 1 + x 1 + 1 x 1 + 1 x 1 = 1 + + 1 + 1 = 1,11 1 3 2 3 2 1112 = 1 x 2 + x 2 + 1 x 2 + 1 x 2 = 1 x 8 + x 4 + 1 x 2 + 1 x 1 = 8 + + 2 + 1 = 11 1 3 2 1118 = 1 x 8 + x 8 + 1 x 8 + 1 x 8 = 1 x 512 + x 64 + 1 x 8 + 1 x 1 = 512 + + 8 + 1 = 521 1 11116 = 1 x 16 + x 16 + 1 x 16 + 1 x 16 = 1 x 65,536 + x 256 + 1 x 16 + 1 x 1 = 65,536 + 256 + 16 + 1 = 65,89 1 3 2 <><><><><><><><><><><><><><><><><><><><><> 2 5B716 = 5 x 16 + 11 x 16 + 7 x 16 = 5 x 256 + 11 x 16 + 7 x 1 = 1,28 + 176 + 7 = 1,463 1 Number Systems by Gerry Donaldson Page 3 of 6 December 2, 27

Every octal digit corresponds precisely to three binary digits. 472 8 48 78 28 12 1112 12 Every hex digit corresponds precisely to four binary digits. F5A 16 F16 516 A16 11112 112 112 Conversion Strategy Octal to Binary Hexadecimal to Binary From right to left, convert each octal digit to three binary digits. From right to left, convert each octal digit to four binary digits. Binary to Octal Binary to Hexadecimal From right to left, convert each group of three bits to one octal digit. From right to left, convert each group of four bits to one hex digit. Octal to Hexadecimal Hexadecimal to Octal Convert octal to binary, then binary to hexadecimal. Convert hexadecimal to binary, then binary to octal. Binary to Decimal Decimal to Binary http://www.wikihow.com/convert-from-binary-to-decimal http://www.newton.dep.anl.gov/newton/askasci/1995/math/math65.htm http://www.wikihow.com/convert-from-decimal-to-binary Octal to Decimal See above: Converting other bases to Decimal. Decimal to Octal Hex to Decimal See above: Converting other bases to Decimal. Decimal to Hex Number Systems by Gerry Donaldson Page 4 of 6 December 2, 27

Subtraction In The Base 16: Example: X 16 = FEED 16-6ACE16 First jot this down: A=1 B=11 C=12 D=13 E=14 F=15 Keep the digits of the same magnitude in the same columns. F16 E16 E16 D16 616 A16 C16 E16 Convert base 16 digits to decimal values because that is the base that you think with. 15 14 14 13 6 1 12 14 Write result by column following same rules as decimal subtraction, but adjust for hexadecimal. When borrowing 1 group from the next column, borrow a group of 16, not 1 (base is 16). 15 14 Borrow 1 group of 16: 14 13 13 + 16 = 29 6 1 12 14 Subtract, keeping results in the correct column. 15 14 13 29 6 1 12 14 91 41 11 151 Convert results column by column back to hexadecimal digits. 916 416 116 F16 <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> Solve for Unknown Value X in Different Bases: Example: X 16 = 36768 The word bit is derived from the phrase binary digit. A bit is the digit one (1) or zero (). Start With Base 16 Value = Start With Base 8 Value X 16 = 3 6 7 6 = 11 11 111 11 Group Octal as 3 bits per octal digit. = 111 111 111 Group Hex as 4 bits per hex digit. = 71 111 141 Convert Bits to Decimal digits. = Recall Base 16: A=1 B=11 C=12 D=13 E=14 F=15 = 716 B 16 E16 Result is now in Base 16 Number Systems by Gerry Donaldson Page 5 of 6 December 2, 27

Solve for Unknown Value X in Different Bases: Example: X37 = 1XF 8 16 First jot this down: A=1 B=11 C=12 D=13 E=14 F=15 Start With Base 8 Value = Start With Base 16 Value X 3 7 8 = 1 X F 16 2 2 X x 8 + 3 x 8 + 7 x 8 = 1 x 16 + X x 16 + F x 16 X x 64 + 3 x 8 + 7 x 1 = 1 x 256 + X x 16 + 15 x 1 64X + 24 + 7 = 256 + 16X + 15 64X - 16X = 256 + 15-24 - 7 48X = 24 X = 24 / 48 X = 5 5 3 7 8 = 1 5 F 16 <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> Solve for Unknown Value X in Different Bases: Example: 47X = 1XB First jot this down: A=1 B=11 C=12 D=13 E=14 F=15 8 16 Start With Base 8 Value = Start With Base 16 Value 4 7 X 8 = 1 X B 16 2 2 4 x 8 + 7 x 8 + X x 8 = 1 x 16 + X x 16 + 11 x 16 4 x 64 + 7 x 8 + X x 1 = 1 x 256 + X x 16 + 11 x 1 256 + 56 + X = 256 + 16X + 11 X - 16X = 256 + 11-256 - 56-15X = - 45 X = - 45 / - 15 X = 3 4 7 3 8 = 1 3 B 16 This document was developed to help students prepare for the ACSL Contest #1 of 27/8. See: http://www.comscigate.com/hw/cs32/acsl/acsl.htm Links to further resources: http://www.comscigate.com/numsystems/numsys.htm Number Systems by Gerry Donaldson Page 6 of 6 December 2, 27