Chapter 9 - Number Systems

Similar documents
MATH Dr. Halimah Alshehri Dr. Halimah Alshehri

Number Theory: Representations of Integers

NUMBERS AND CODES CHAPTER Numbers

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

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

CHAPTER 2 NUMBER SYSTEMS

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

Four Important Number Systems

ECE260: Fundamentals of Computer Engineering

Conversions between Decimal and Binary

Binary addition example worked out

ECE380 Digital Logic. Positional representation

ENGIN 112 Intro to Electrical and Computer Engineering

CSE 241 Digital Systems Spring 2013

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

Week No. 06: Numbering Systems

Digital Circuits, Binary Numbering, and Logic Gates Cornerstone Electronics Technology and Robotics II

ENGIN 112 Intro to Electrical and Computer Engineering

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

CISC 1400 Discrete Structures

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

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

Counting in Different Number Systems

CSEN102 Introduction to Computer Science

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

1 Computing System 2. 2 Data Representation Number Systems 22

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

You separate binary numbers into columns in a similar fashion. 2 5 = 32

3 The fundamentals: Algorithms, the integers, and matrices

Numbers. Dr Hammadi Nait-Charif. Senior Lecturer Bournemouth University United Kingdom

Base Number Systems. Honors Precalculus Mr. Velazquez

of Digital Electronics

4 Number Theory and Cryptography

5 + 9(10) + 3(100) + 0(1000) + 2(10000) =

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

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

Chapter 1 The Real Numbers

Exponential and logarithm functions

Part I, Number Systems. CS131 Mathematics for Computer Scientists II Note 1 INTEGERS

Representing Numbers on the Computer

Discrete mathematics is the study of techniques, ideas and modes of

Hakim Weatherspoon CS 3410 Computer Science Cornell University

Sail into Summer with Math!

MATH 521, WEEK 2: Rational and Real Numbers, Ordered Sets, Countable Sets

Quantitative Aptitude

CIS102 Mathematics for Computing Volume 1

Digital Systems Roberto Muscedere Images 2013 Pearson Education Inc. 1

Number System conversions

4. Number Theory (Part 2)

Natural Numbers: Also called the counting numbers The set of natural numbers is represented by the symbol,.

Long division for integers

CHAPTER 7. Exercises 17/ / /2 2 0

N= {1,2,3,4,5,6,7,8,9,10,11,...}

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

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

Algorithms: Lecture 2

Math /Foundations of Algebra/Fall 2017 Foundations of the Foundations: Proofs

Prepared by Sa diyya Hendrickson. Package Summary

Discrete Mathematics GCD, LCM, RSA Algorithm

FYSE410 DIGITAL ELECTRONICS [1] [2] [3] [4] [5] A number system consists of an ordered set of symbols (digits).

Chapter 1 CSCI

Lecture 2. The Euclidean Algorithm and Numbers in Other Bases

With Question/Answer Animations. Chapter 4

where Q is a finite set of states

Math 016 Lessons Wimayra LUY

Longest Common Prefixes

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

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

THE LOGIC OF COMPOUND STATEMENTS

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.

How do computers represent numbers?

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

Introduction CSE 541

Introduction to Quantum Computation

What Fun! It's Practice with Scientific Notation!

Computer Architecture 10. Residue Number Systems

COT 3100 Applications of Discrete Structures Dr. Michael P. Frank

Lecture notes on Turing machines

CSE 20: Discrete Mathematics

Binary Arithmetic: counting with ones

Review of Functions. Functions. Philippe B. Laval. Current Semester KSU. Philippe B. Laval (KSU) Functions Current Semester 1 / 12

Floating Point Number Systems. Simon Fraser University Surrey Campus MACM 316 Spring 2005 Instructor: Ha Le

Introduction to Number Theory. The study of the integers

Introduction Integers. Discrete Mathematics Andrei Bulatov

The Euclidean Algorithm and Multiplicative Inverses

Number theory (Chapter 4)

Fundamentals of Digital Design

Number Systems. There are 10 kinds of people those that understand binary, those that don t, and those that expected this joke to be in base 2

Chapter 1: Preliminaries and Error Analysis

Standard forms for writing numbers

With Question/Answer Animations

GCSE AQA Mathematics. Numbers

Homework Assignment 6 Answers

Informatics 1 - Computation & Logic: Tutorial 3

Working with Square Roots. Return to Table of Contents

Beyond Whole Number Bases

Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6

Design of Digital Circuits Reading: Binary Numbers. Required Reading for Week February 2017 Spring 2017

Number Bases. Ideally this should lead to discussions on polynomials see Polynomials Question Sheet.

Scientific Notation. exploration. 1. Complete the table of values for the powers of ten M8N1.j. 110 Holt Mathematics

Transcription:

Chapter 9 - Number Systems Luis Tarrataca luis.tarrataca@gmail.com CEFET-RJ L. Tarrataca Chapter 9 - Number Systems 1 / 50

1 Motivation 2 Positional Number Systems 3 Binary System L. Tarrataca Chapter 9 - Number Systems 2 / 50

4 Converting between Decimal and Binary 5 Hexadecimal Notation 6 References L. Tarrataca Chapter 9 - Number Systems 3 / 50

Motivation Motivation Lets start the semester with an easy subject: In everyday life how do you count numbers? Any ideas? L. Tarrataca Chapter 9 - Number Systems 4 / 50

Motivation Motivation Lets start the semester with an easy subject: In everyday life how do you count numbers? Any ideas? ;) 1 Fingers; 2 Fingers; 3 Fingers; 10 Fingers; L. Tarrataca Chapter 9 - Number Systems 5 / 50

Motivation Decimal system is used to represent numbers: Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9; Consider the number 83: What does this mean using the decimal system? Any ideas? L. Tarrataca Chapter 9 - Number Systems 6 / 50

Motivation Example Consider the number 83: What does this mean using the decimal system? Any ideas? Number 10 was counted 8 times: 8 10 = 8 10 1 Number 1 was counted 3 times: 3 = 3 10 0 Combining these elements: I.e.: 83 = 8 10+3 = 8 10 1 + 3 10 0 L. Tarrataca Chapter 9 - Number Systems 7 / 50

Motivation Example Consider the number 4728: What does this mean using the decimal system? Any ideas? L. Tarrataca Chapter 9 - Number Systems 8 / 50

Motivation Exercise Consider the number 4728: What does this mean using the decimal system? Any ideas? Number 1000 was counted X times: Number 100 was counted Y times: Number 10 was counted Z times: Number 1 was counted D times: Combining these elements: L. Tarrataca Chapter 9 - Number Systems 9 / 50

Motivation Exercise Consider the number 4728: What does this mean using the decimal system? Any ideas? Number 1000 was counted 4 times: 4 1000 = 4 10 3 Number 100 was counted 7 times: 7 100 = 7 10 2 Number 10 was counted 2 times: 2 10 = 2 10 1 Number 1 was counted 8 times: 8 = 8 10 0 Combining these elements: I.e.: 4728 = 4 10 3 + 7 10 2 + 2 10 1 + 8 10 0 L. Tarrataca Chapter 9 - Number Systems 10 / 50

Motivation But what if we have decimal fractions? Any ideas? L. Tarrataca Chapter 9 - Number Systems 11 / 50

Motivation But what if we have decimal fractions? Any ideas? E.g.: how do we represent the number 0.256 using the decimal system? L. Tarrataca Chapter 9 - Number Systems 12 / 50

Motivation Example Consider the number 0.256: What does this mean using the decimal system? Any ideas? Number 0.1 was counted 2 times: 2 0.1 = 2 10 1 Number 0.01 was counted 5 times: 5 0.01 = 5 10 2 Number 0.001 was counted 6 times: 6 10 3 = 6 10 3 Combining these elements: I.e.: 0.256 = 2 10 1 + 5 10 2 + 6 10 3 L. Tarrataca Chapter 9 - Number Systems 13 / 50

Motivation But wait: What if we have an integer part and a fractional part? Any ideas? L. Tarrataca Chapter 9 - Number Systems 14 / 50

Motivation But wait: What if we have an integer part and a fractional part? Any ideas? E.g.: how do we represent the number 442.256 using the decimal system? L. Tarrataca Chapter 9 - Number Systems 15 / 50

Motivation Example Consider the number 442.256: What does this mean using the decimal system? Any ideas? L. Tarrataca Chapter 9 - Number Systems 16 / 50

Motivation Exercise Consider the number 442.256: What does this mean using the decimal system? Any ideas? Number 100 was counted X times: Number 10 was counted Y times: Number 1 was counted Z times: Number 0.1 was counted Q times: Number 0.01 was counted W times: Number 0.001 was counted E times: Combining these elements: I.e.: 442.256 = L. Tarrataca Chapter 9 - Number Systems 17 / 50

Motivation Exercise Consider the number 442.256: What does this mean using the decimal system? Any ideas? Number 100 was counted 4 times: 4 100 = 4 10 2 Number 10 was counted 4 times: 4 10 = 4 10 1 Number 1 was counted 2 times: 2 1 = 2 10 0 Number 0.1 was counted 2 times: 2 0.1 = 2 10 1 Number 0.01 was counted 5 times: 5 0.01 = 5 10 2 Number 0.001 was counted 6 times: 6 0.001 = 6 10 3 Combining these elements: I.e.: 442.256 = 4 10 2 + 4 10 1 + 2 10 0 + 2 10 1 + 5 10 2 + 6 10 3 L. Tarrataca Chapter 9 - Number Systems 18 / 50

Motivation Some important observations: Decimal system is said to have a base, or radix, of 10; In any number: Leftmost digit is referred to as the most significant digit (MSD); Rightmost digit is called the least significant digit (LSD); L. Tarrataca Chapter 9 - Number Systems 19 / 50

Motivation In conclusion: Figure: Positional Interpretation of a Decimal Number (Source: [Stallings, 2015]) In general, X where: X = { d 2 d 1 d 0.d 1 d 2 d 3 } X = i (d i 10 i ) L. Tarrataca Chapter 9 - Number Systems 20 / 50

Positional Number Systems Positional Number Systems Decimal system illustrates a positional number system (1/2): Each number is represented by a string of digits; Each digit position i has an associated weight r i : r is the radix / base of the system; General form of a number in such a system with radix r is: Where a i : 0 a i < r ( a 3 a 2 a 1 a 0.a 1 a 2 a 3 ) r L. Tarrataca Chapter 9 - Number Systems 21 / 50

Positional Number Systems Positional Number Systems Decimal system illustrates a positional number system (2/2): Number is defined to have the value: a 3 r 3 + a 2 r 2 + a 1 r 1 + a 0 r 0 + a 3 r 1 L. Tarrataca Chapter 9 - Number Systems 22 / 50

Positional Number Systems The question is: Do we really need to use the decimal system? Any ideas? Decimal system: Radix 10; Digits in the range 0 through 9 What if human beings had 12 fingers? L. Tarrataca Chapter 9 - Number Systems 23 / 50

Positional Number Systems What if human beings had 12 fingers? Radix 12; Digits in the range 0 through 11; L. Tarrataca Chapter 9 - Number Systems 24 / 50

Positional Number Systems Fun fact You think 12 fingers is weird? L. Tarrataca Chapter 9 - Number Systems 25 / 50

Positional Number Systems Fun fact You think 12 fingers is weird? Have a look at Polydactyly: L. Tarrataca Chapter 9 - Number Systems 26 / 50

Binary System Binary System Binary system only uses two digits: Radix / base 2; Binary digits 1 and 0 have the same meaning as in decimal notation: 0 2 = 0 10 1 2 = 1 10 Also a positional number system: Each binary digit in a number has a value; L. Tarrataca Chapter 9 - Number Systems 27 / 50

Binary System Exercise 10 2 =? 10 11 2 =? 10 100 2 =? 10 L. Tarrataca Chapter 9 - Number Systems 28 / 50

Binary System Exercise 10 2 = (1 2 1 )+(0 2 0 ) = 2 10 11 2 = (1 2 1 )+(1 2 0 ) = 3 10 100 2 = (1 2 2 )+(0 2 1 )+(0 2 0 ) = 4 10 L. Tarrataca Chapter 9 - Number Systems 29 / 50

Binary System But what if are trying to represent a binary number with a fractional part? Any ideas? L. Tarrataca Chapter 9 - Number Systems 30 / 50

Binary System But what if are trying to represent a binary number with a fractional part? Any ideas? Binary number 1001.101 2 converts to what decimal number? L. Tarrataca Chapter 9 - Number Systems 31 / 50

Binary System Exercise 1001.101 2 =? 10 L. Tarrataca Chapter 9 - Number Systems 32 / 50

Binary System Exercise 1001.101 = 1 2 3 + 0 2 2 + 0 2 1 1 2 0 + 1 2 1 + 0 2 2 + 1 2 3 = 9.62510 L. Tarrataca Chapter 9 - Number Systems 33 / 50

Binary System Remember this formula for the decimal system: X = { d 2 d 1 d 0.d 1 d 2 d 3 } X = i (d i 10 i ) What do you think would be the necessary changes for a binary system? Any ideas? L. Tarrataca Chapter 9 - Number Systems 34 / 50

Binary System Remember this formula for the decimal system: X = { d 2 d 1 d 0.d 1 d 2 d 3 } X = i (d i 10 i ) What do you think would be the necessary changes for a binary system? Any ideas? Radix / base has value 2; I.e.: X = i (d i 2 i ) L. Tarrataca Chapter 9 - Number Systems 35 / 50

Converting between Decimal and Binary Converting between Decimal and Binary How can we convert between decimal and binary numbers? Any ideas? L. Tarrataca Chapter 9 - Number Systems 36 / 50

Converting between Decimal and Binary Converting between Decimal and Binary How can we convert between decimal and binary numbers? Any ideas? Suppose we need to convert N from decimal into binary form (1/3): If we divide N by 2 we obtain a quotient N 1 and a remainder R 0 ; We then may write: N = 2 N 1 + R 0 R 0 = 0 or 1 L. Tarrataca Chapter 9 - Number Systems 37 / 50

Converting between Decimal and Binary Suppose we need to convert N from decimal into binary form (2/3): N 1 can also be divided by 2, then: N 1 = 2 N 2 + R 1 R 1 = 0 or 1 L. Tarrataca Chapter 9 - Number Systems 38 / 50

Converting between Decimal and Binary Suppose we need to convert N from decimal into binary form (3/3): N 2 can also be divided by 2, then: N 2 = 2 N 3 + R 2 R 2 = 0 or 1 Continuing this sequence will eventually produce: a quotient N m 1 = 1 a remainder R m 2 which is 0 or 1; L. Tarrataca Chapter 9 - Number Systems 39 / 50

Converting between Decimal and Binary We are now able to obtain the binary form: N = (R m 1 2 m 1 )+(R m 2 2 m 2 )+ +(R 2 2 2 )+(R 1 2 1 )+R 0 L. Tarrataca Chapter 9 - Number Systems 40 / 50

Converting between Decimal and Binary Example Figure: (Source: [Stallings, 2015]) L. Tarrataca Chapter 9 - Number Systems 41 / 50

Converting between Decimal and Binary Example Figure: (Source: [Stallings, 2015]) L. Tarrataca Chapter 9 - Number Systems 42 / 50

Converting between Decimal and Binary Exercise Converting the following decimal numbers into binary: 8 10 =? 2 9 10 =? 2 1024 10 =? 2 1025 10 =? 2 1027 10 =? 2 2049 10 =? 2 4096 10 =? 2 4106 10 =? 2 L. Tarrataca Chapter 9 - Number Systems 43 / 50

Hexadecimal Notation Hexadecimal Notation In computation: All forms of data is represented in a binary fashion; Very cumbersome for human beings =( Most computer professionals prefer a more compact notation: Hexadecimal notation FTW! =) Binary digits are grouped into sets of four bits (nibble); Each possible combination of four binary digits is given a symbol; L. Tarrataca Chapter 9 - Number Systems 44 / 50

Hexadecimal Notation This is the hexadecimal table: Figure: (Source: [Stallings, 2015]) In general: Z = i (h i 16 i ) Radix / base has value 16; Each hexadecimal digit h i is in the decimal range 0 h i < 15; L. Tarrataca Chapter 9 - Number Systems 45 / 50

Hexadecimal Notation Figure: (Source: [Stallings, 2015]) L. Tarrataca Chapter 9 - Number Systems 46 / 50

Hexadecimal Notation Example 2C 16 =? 10 L. Tarrataca Chapter 9 - Number Systems 47 / 50

Hexadecimal Notation Example 2C 16 = (2 16 16 1 )+(C 16 16 0 ) = (2 10 16 1 )+(12 10 16 0 ) = 44 L. Tarrataca Chapter 9 - Number Systems 48 / 50

Hexadecimal Notation This concludes this lession: Thank you for your time =) L. Tarrataca Chapter 9 - Number Systems 49 / 50

References References I Stallings, W. (2015). Computer Organization and Architecture. Pearson Education. L. Tarrataca Chapter 9 - Number Systems 50 / 50