Chapter 2 Binary Values and Number Systems

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

Electronic Data and Instructions

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr

Chapter 2. Binary Values and Number Systems

QUIZ: Generations of computer technology. Hardware:

QUIZ: Generations of computer technology. Hardware:

Level ISA3: Information Representation

COE 202: Digital Logic Design Number Systems Part 2. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

Number representations

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

Number System. Introduction. Decimal Numbers

CS & IT Conversions. Magnitude 10,000 1,

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

Chapter 2 Exercises and Answers

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

CMPE223/CMSE222 Digital Logic Design. Positional representation

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Number Systems. Both numbers are positive

CHAPTER 2 Number Systems

in this web service Cambridge University Press

What Is It? Instruction Register Address Register Data Register

Introduction to Numbering Systems

2 Number Systems 2.1. Foundations of Computer Science Cengage Learning

BINARY SYSTEM. Binary system is used in digital systems because it is:

Chapter 4 Section 2 Operations on Decimals

Octal & Hexadecimal Number Systems. Digital Electronics

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

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

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Number Systems CHAPTER Positional Number Systems

Digital Fundamentals

Beyond Base 10: Non-decimal Based Number Systems

6. Binary and Hexadecimal

Chapter 1 Emad Felemban

Unit 3: Multiplication and Division Reference Guide pages x 7 = 392 factors: 56, 7 product 392

Computer Arithmetic. Appendix A Fall 2003 Lec.03-58

Introduction to Computer Science (I1100) With 1 coin 2 possibilities: Head / Tail or 0/1

Fundamentals of Programming (C)

Lecture 2: Number Systems

Section 2.3 Rational Numbers. A rational number is a number that may be written in the form a b. for any integer a and any nonzero integer b.

Bits. Binary Digits. 0 or 1

CHW 261: Logic Design

CS321. Introduction to Numerical Methods

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

Hexadecimal Numbers. Journal: If you were to extend our numbering system to more digits, what digits would you use? Why those?

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

Number Systems. TA: Mamun. References: Lecture notes of Introduction to Information Technologies (ITEC 1011) by Dr Scott MacKenzie

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

COMP Overview of Tutorial #2

Computer Sc. & IT. Digital Logic. Computer Sciencee & Information Technology. 20 Rank under AIR 100. Postal Correspondence

MACHINE LEVEL REPRESENTATION OF DATA

Beyond Base 10: Non-decimal Based Number Systems

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

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

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

TOPIC: NUMBER SYSTEMS

Introduction to Computers and Programming. Numeric Values

Objectives. Connecting with Computer Science 2

Digital Systems and Binary Numbers

Chapter (1) Eng. Mai Z. Alyazji

CS 31: Intro to Systems Binary Representation. Kevin Webb Swarthmore College January 27, 2015

Digital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes

Chapter 5: Computer Arithmetic. In this chapter you will learn about:

Divide: Paper & Pencil

Conversion Between Number Bases

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

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR

Learning Objectives. Binary over Decimal. In this chapter you will learn about:

Chapter 1 Preliminaries

DATA REPRESENTATION. By- Neha Tyagi PGT CS KV 5 Jaipur II Shift, Jaipur Region. Based on CBSE curriculum Class 11. Neha Tyagi, KV 5 Jaipur II Shift

(Type your answer in radians. Round to the nearest hundredth as needed.)

Digital Logic Lecture 2 Number Systems

EE292: Fundamentals of ECE

Octal and Hexadecimal Integers

Introduction to Computer Science-103. Midterm

Korea University of Technology and Education

Example 2: Simplify each of the following. Round your answer to the nearest hundredth. a

Logic and Computer Design Fundamentals. Chapter 1 Digital Computers and Information

Digital Logic Design Exercises. Assignment 1

The. Binary. Number System

计算机信息表达. Information Representation 刘志磊天津大学智能与计算学部

T02 Tutorial Slides for Week 2

UNIT1: COMPUTERNUMBER SYSTEM

Math Glossary Numbers and Arithmetic

Unit 2: Accentuate the Negative Name:

LECTURE 1-2. Introduction and Number Systems

Chapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude

Decimal/Binary Conversion on the Soroban

Chapter 1 Review of Number Systems

CHAPTER 2 (b) : AND CODES

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

EXAMPLE 1. Change each of the following fractions into decimals.

Chapter Binary Representation of Numbers

The Rational Number System: Investigate Rational Numbers: Play Answer Sheet

Number Systems & Encoding

Numeral system Numerals

Chapter 5: Computer Arithmetic

CS 31: Intro to Systems Binary Representation. Kevin Webb Swarthmore College September 6, 2018

Rational number operations can often be simplified by converting mixed numbers to improper fractions Add EXAMPLE:

LESSON TITLE. Language English Local Language Introduction to Computer Science. Mr. VAR Sovannrath Submission Date October 30th, 2014 Version 1.

Transcription:

Chapter 2 Binary Values and Number Systems

Chapter Goals 10 進位 2 / 8 / 16 進位 進位系統間轉換 各進位系統小數表示 各進位系統加減法 各進位系統乘除法 2 24 6

Numbers Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative Numbers A value less than 0, with a sign Examples: -24, -1, -45645, -32 3 2

Numbers Integers A natural number, a negative number, zero Examples: 249, 0, - 45645, - 32 Rational Numbers An integer or the quotient of two integers Examples: -249, -1, 0, 3/7, -2/5 4 3

Positional Notation Continuing with our example 642 in base 10 positional notation is: 6 x 10 2 = 6 x 100 = 600 + 4 x 10 1 = 4 x 10 = 40 + 2 x 10º = 2 x 1 = 2 = 642 in base 10 This number is in base 10 5 The power indicates the position of the number 6

Positional Notation As a formula: R is the base of the number d n * R n-1 + d n-1 * R n-2 +... + d 2 * R + d 1 n is the number of digits in the number d is the digit in the i th position in the number 642 is 6 3 * 10 2 + 4 2 * 10 + 2 1 6 7

Positional Notation What if 642 has the base of 13? + 6 x 13 2 = 6 x 169 = 1014 + 4 x 13 1 = 4 x 13 = 52 + 2 x 13º = 2 x 1 = 2 = 1068 in base 10 642 in base 13 is equivalent to 1068 in base 10 7 68

Binary Decimal is base 10 and has 10 digits: 0,1,2,3,4,5,6,7,8,9 Binary is base 2 and has 2 digits: 0,1 For a number to exist in a given base, it can only contain the digits in that base, which range from 0 up to (but not including) the base. What bases can these numbers be in? 122, 198, 178, G1A4 8 9

Binary Numbers and Computers Computers have storage units called binary digits or bits Low Voltage = 0 High Voltage = 1 all bits have 0 or 1 9 22

Binary and Computers Byte 8 bits The number of bits in a word determines the word length of the computer, but it is usually a multiple of 8 32-bit machines 64-bit machines etc. 10 23

Bases Higher than 10 How are digits in bases higher than 10 represented? With distinct symbols for 10 and above. Base 16 has 16 digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, and F 11 10

Converting Octal to Decimal What is the decimal equivalent of the octal number 642? 6 x 8 2 = 6 x 64 = 384 + 4 x 8 1 = 4 x 8 = 32 + 2 x 8º = 2 x 1 = 2 = 418 in base 10 12 11

Converting Hexadecimal to Decimal What is the decimal equivalent of the hexadecimal number DEF? D x 16 2 = 13 x 256 = 3328 + E x 16 1 = 14 x 16 = 224 + F x 16º = 15 x 1 = 15 = 3567 in base 10 Remember, the digits in base 16 are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F 13

Converting Binary to Decimal What is the decimal equivalent of the binary number 1101110? 1 x 2 6 = 1 x 64 = 64 + 1 x 2 5 = 1 x 32 = 32 + 0 x 2 4 = 0 x 16 = 0 + 1 x 2 3 = 1 x 8 = 8 + 1 x 2 2 = 1 x 4 = 4 + 1 x 2 1 = 1 x 2 = 2 + 0 x 2º = 0 x 1 = 0 = 110 in base 10 14 13

Arithmetic in Binary Remember that there are only 2 digits in binary, 0 and 1 1 + 1 is 0 with a carry 1 1 1 1 1 1 1 0 1 0 1 1 1 +1 0 0 1 0 1 1 1 0 1 0 0 0 1 0 Carry Values 15 14

Subtracting Binary Numbers Remember borrowing? Apply that concept here: 1 2 2 0 2 1 0 1 0 1 1 1-1 1 1 0 1 1 0 0 1 1 1 0 0 16 15

17 Counting in Binary/Octal/Decimal

Binary-hexadecimal conversion

Binary-octal conversion

Converting Binary to Octal Mark groups of three (from right) Convert each group 10101011 10 101 011 2 5 3 10101011 is 253 in base 8 20 17

Converting Binary to Hexadecimal Mark groups of four (from right) Convert each group 10101011 1010 1011 A B 10101011 is AB in base 16 21 18

Octal-hexadecimal conversion

Converting Decimal to Other Bases Algorithm for converting number in base 10 to other bases While (the quotient is not zero) Divide the decimal number by the new base Make the remainder the next digit to the left in the answer Replace the original decimal number with the quotient 23 19

Converting Decimal to Octal What is 1988 (base 10) in base 8? 248 31 3 0 8 1988 8 248 8 31 8 3 16 24 24 0 38 08 7 3 32 8 68 0 64 4 Answer is : 3 7 0 4 24

Converting Decimal to Hexadecimal What is 3567 (base 10) in base 16? 222 13 0 16 3567 16 222 16 13 32 16 0 36 62 13 32 48 47 14 32 15 D E F 25 21

Converting the integral part of a number in decimal to other bases

Example 1 The following shows how to convert 35 in decimal to binary. We start with the number in decimal, we move to the left while continuously finding the quotients and the remainder of division by 2. The result is 35 = (100011) 2.

Example 2 The following shows how to convert 126 in decimal to its equivalent in the octal system. We move to the right while continuously finding the quotients and the remainder of division by 8. The result is 126 = (176) 8.

Example 3 The following shows how we convert 126 in decimal to its equivalent in the hexadecimal system. We move to the right while continuously finding the quotients and the remainder of division by 16. The result is 126 = (7E) 16

Converting the fractional part of a number in decimal to other bases

Example 4 Convert the decimal number 0.625 to binary. Since the number 0.625 = (0.101) 2 has no integral part, the example shows how the fractional part is calculated.

Example 5 The following shows how to convert 0.634 to octal using a maximum of four digits. The result is 0.634 = (0.5044) 8. Note that we multiple by 8 (base octal).

Example 6 The following shows how to convert 178.6 in decimal to hexadecimal using only one digit to the right of the decimal point. The result is 178.6 = (B2.9) 16 Note that we divide or multiple by 16 (base hexadecimal).

Example 7 The following shows the place values for the real number +24.13.

Example 8 The following shows that the number (101.11) 2 in binary is equal to the number 5.75 in decimal.

Example 9 The following shows how to convert the binary number (110.11) 2 to decimal: (110.11) 2 = 6.75.

Example 10 The following shows how to convert the hexadecimal number (1A.23) 16 to decimal. Note that the result in the decimal notation is not exact, because 3 16 2 = 0.01171875. We have rounded this value to three digits (0.012).

Summary of the four positional systems

Addition and Subtraction (10001010) 2 +(1001) 2 =(?) 2 or (?) 16 (7B4) 16 +(6A) 16 =(?) 16 (754) 8 +(6A) 16 =(?) 8 and (?) 16 (7B4) 16 -(6A) 16 =(?) 16 (754) 8 -(6A) 16 =(?) 8 and (?) 16

Multiply and Division (AD) 16 (A) 16 =(?) 16 (754) 8 (234) 8 =(?) 8 and (?) 16 (75) 8 (1101) 2 =(?) 2 (6C2) 16 (A) 16 =(?) 16 (9C) 16 (20) 8 =(?) 16