Lecture for Week 9 2013 Spring.  Numbers can be represented in many ways. We are familiar with the decimal system since it is most widely used in everyday.

Slides:



Advertisements
Similar presentations
Intro to CS – Honors I Representing Numbers GEORGIOS PORTOKALIDIS
Advertisements

HEXADECIMAL NUMBERS Code
Binary Addition Rules Adding Binary Numbers = = 1
Digital Fundamentals Floyd Chapter 2 Tenth Edition
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
Assembly Language and Computer Architecture Using C++ and Java
Chapter Chapter Goals Know the different types of numbers Describe positional notation.
1 CSE-221 Digital Logic Design (DLD) Lecture-1: Digital Systems & Number Systems.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
The Binary Number System
Data Representation in Computers. Data Representation in Computers/Session 3 / 2 of 33 Number systems  The additive approach – Number earlier consisted.
Numbering Systems Decimal (Denary) base 10. Clumsy when dealing with computers. Other systems –Binary –Octal –Hexadecimal Convenient when dealing with.
Real Numbers and the Decimal Number System
Data Representation Number Systems.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Numbering systems.
Positional Number Systems
1 Arithmetic and Logical Operations - Part II. Unsigned Numbers Addition in unsigned numbers is the same regardless of the base. Given a pair of bit sequences.
Copyright © Cengage Learning. All rights reserved. CHAPTER 2 THE LOGIC OF COMPOUND STATEMENTS THE LOGIC OF COMPOUND STATEMENTS.
Numeral Systems Subjects: Numeral System Positional systems Decimal
Numbering Systems CS208.
Computer Arithmetic Nizamettin AYDIN
PRESENTATION 1 Whole Numbers. PLACE VALUE The value of any digit depends on its place value Place value is based on multiples of 10 as follows: UNITS.
© 2010 Pearson Prentice Hall. All rights reserved. CHAPTER 4 Number Representation and Calculation.
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
Decimals.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Number Systems. Why binary numbers? Digital systems process information in binary form. That is using 0s and 1s (LOW and HIGH, 0v and 5v). Digital designer.
Lecture 4 Last Lecture –Positional Numbering Systems –Converting Between Bases Today’s Topics –Signed Integer Representation Signed magnitude One’s complement.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
Computer Arithmetic and the Arithmetic Unit Lesson 2 - Ioan Despi.
Chapter 2: The Logic of Compound Statements 2.5 Application: Number Systems and Circuits for Addition 1 Counting in binary is just like counting in decimal.
1 Week 2: Binary, Octal and Hexadecimal Numbers READING: Chapter 2.
Operations on Bits Arithmetic Operations Logic Operations
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
Number Systems & Operations
07/12/ Data Representation Two’s Complement & Binary Arithmetic.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
Introduction To Number Systems Binary System M. AL-Towaileb1.
Chapter 1 Number Systems Digital Electronics. Topics discussed in last lecture Digital systems Advantages of using digital signals over analog. Disadvantages.
EEE342 Digital Electronics Ian McCrumRoom 5B18, Lecture 2: Codes & Arithmetic.
Number Systems – Definitions page 214 The radix or base 밑 refers to the number b in an expression of the form b n. The number n is called the exponent.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
Number Systems. Topics  The Decimal Number System  The Binary Number System  Converting from Binary to Decimal  Converting from Decimal to Binary.
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.
Binary Addition The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying:
Week 1(Number System) Muhammad Ammad uddin Logic Design Lab I (CEN211)
Prepared By: Norakmar Binti Mohd Nadzari CHAPTER 2 ARITHMETIC AND LOGIC UNIT.
Introduction To Number Systems
Digital Logic & Design Adil Waheed Lecture 02.
Digital Logic & Design Dr. Waseem Ikram Lecture 02.
COMPUTING FUNDAMENTALS
Chapter R Prealgebra Review Decimal Notation.
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
Numbering System TODAY AND TOMORROW 11th Edition
Digital Logic & Design Lecture 02.
Computation in Other Bases
Digital Logic Design (ECEg3141) 2. Number systems, operations & codes 1.
Digital Electronics and Microprocessors
Binary to Decimal Conversion
Copyright © Cengage Learning. All rights reserved.
Introduction To Number Systems
CHAPTER 69 NUMBER SYSTEMS AND CODES
Presentation transcript:

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 life. The decimal system is an example of a positional number system. Each digit has a place value that depends on its position with respect to the decimal point. The Binary Number System

 Example: = 2* * *10+6* * *10 -2 where 6 represents number of units, 8 number of tens, 3 number of hundreds, 2 number of thousands To the right of decimal point we have 7 number of tenths, 5 number of hundredths, and so on. The Binary Number System

 The decimal system is said to use a base of 10 because the place values are powers of 10. Because we use the decimal system all the time it is easy to forget that there is no mathematical reason for using powers of 10 as the place values. The choice of 10 probably arose because people used their 10 fingers for counting. But in fact we can use any number as the base of a positional number system. A familiar example of non-decimal number system is the subdivision of an hour into 60mins, a minute into 60sec. 2 h 26 m 35 s = 2* * *60 0 The Binary Number System

 It turns out that in Computing bases 2, 8 and 16 are particularly useful. Base 2 is the binary number system Base 8 is the octal number system Base 16 is the hexadecimal number system The binary number system is a positional number system that uses 2 as the base. For the purpose of this course we shall be working only with non-negative integers ( Z +  {0} ). The Binary Number System

 Example: = 1*2 4 +0*2 3 +1*2 2 +1*2 1 +0*2 0 = = 22 Note that subscript 2 represents base 2 and it is necessary to state it unless we work in the decimal number system. (Expressing negative numbers or real numbers is not really any different) The Binary Number System

 The table shows the integers from 0 to 20 in their binary representation The Binary Number System BinaryDecimalBinaryDecimal

 The binary system uses the 2 binary digits 0 and 1. Every number in binary will appear as strings of zeros and ones. In octal as strings of 0,1,2,…7 In decimal as strings of 0,1,2,…,9 In hexadecimal as strings of 0,1,2,…,9,A,B,C,D,E,F where A represents 10, B represents 11, C represents 12, D represents 13, E represents 14 and F represents 15. The Binary Number System

  Base-10 number system  Consist of ten numbers- 0 to 9  Common type of number system used everyday.  Examples- (20) 10, (50) 10, (145) 10, etc. Decimal number system

 From the table we can see that 1. odd numbers end with 1 2. even numbers end with 0 These two lines can be summarised as follows: The last digit in the binary representation is the remainder after dividing the number by 2. Conversion from Decimal to Binary

 So the first step is to divide (integer division) n by 2 to obtain quotient and remainder (both whole numbers and remainder can only be 0 or 1). Quotient remainder form PASCAL notation: N DIV 2 = quotient(7 DIV 2 = 3) N MOD 2 = remainder. (7 MOD 2 = 1) Conversion from Decimal to Binary

 In order to proceed further we make another observation By removing the rightmost digit in a binary representation we obtain the binary representation of n DIV 2. Conversion from Decimal to Binary

 Example1: 14 = removing last digit (0) we obtain 111 which in base 10 represents DIV 2 = 7 Example2 11 = removing last digit (1) we obtain 101 which in base 10 represents DIV 2 = 5 ( DIV only returns quotient) Conversion from Decimal to Binary

 Each time we perform division we record remainder until n DIV 2 (quotient) becomes zero. Then we return the string of remainders in reverse order. Conversion from Decimal to Binary

 Convert (250) 10 to binary 250/2=125remainder is 0 125/2=62remainder is 1 62/2=31remainder is 0 31/2=15remainder is 1 15/2=7remainder is 1 7/2=3remainder is 1 3/2=1remainder is 1 1/2=0remainder is 1 Therefore ….(250) 10 =( ) 2 Decimal to binary Conversion

 Convert 25 into binary. 25 = 12* = 6*2+0 6 = 3*2+0 3 = 1*2+1 1 = 0*2+1 Therefore, 25 = (11001) 2 Decimal to binary Conversion

 Taking binary number as ( )2 0×2 0 =0 1 ×2 1 =2 0 ×2 2 =0 1 ×2 3 =8 1 ×2 4 =16 1 ×2 5 =32 1 ×2 6 =64 1 ×2 7 =128 Adding the numbers we get… =250 Therefore….( ) 2 =(250) 10 Binary to decimal Conversion

 Convert the following as indicated 1.34 to binary 2.64 to binary to binary to decimal to decimal to decimal to binary Practice Problem

 Adding binary numbers is a very simple task, and very similar to the longhand addition of decimal numbers. As with decimal numbers, you start by adding the bits (digits) one column, or place weight, at a time, from right to left. Unlike decimal addition, there is little to memorize in the way of rules for the addition of binary bits: Addition and Multiplication in Binary = = = = = 11

 Just as with decimal addition, when the sum in one column is a two-bit (two-digit) number, the least significant figure is written as part of the total sum and the most significant figure is "carried" to the next left column. Consider the following examples: Addition and Multiplication in Binary

 The addition problem on the left did not require any bits to be carried, since the sum of bits in each column was either 1 or 0, not 10 or 11. In the other two problems, there definitely were bits to be carried, but the process of addition is still quite simple. Addition and Multiplication in Binary

 Binary multiplication is actually much simpler than decimal multiplication. In the case of decimal multiplication, we need to remember 3 x 9 = 27, 7 x 8 = 56, and so on. In binary multiplication, we only need to remember the following, Binary multiplication 0 x 0 = 0 0 x 1 = 0 1 x 0 = 0 1 x 1 = 1

 Note that since binary operates in base 2, the multiplication rules we need to remember are those that involve 0 and 1 only. 101 x11 First we multiply 101 by 1, which produces 101. Then we put a 0 as a placeholder as we would in decimal multiplication, and multiply 101 by 1, which produces x <-- the 0 here is the placeholder Binary multiplication

 The next step, as with decimal multiplication, is to add. The results from our previous step indicates that we must add 101 and 1010, the sum of which is x Binary multiplication

 Multiply and 1011

 Multiply the following: x x x x x 101 Practice Problem

 Subtraction ( and division) of binary numbers is performed in the same way as with decimal numbers. Binary subtraction is simplified as well, as long as we remember how subtraction and the base 2 number system. Let's first look at an easy example. Subtraction and Division

 Since addition is opposite operation of subtraction the table for subtraction can be deduced from the addition table = 0 then = 0; = 1 then = 1; = 1 then = 0; = 0 (and 'carry' 1) then = 1 ( and 'borrow' 1 from the next position ). Subtraction and Division

 Note that the difference is the same if this was decimal subtraction. Also similar to decimal subtraction is the concept of "borrowing." Watch as "borrowing" occurs when a larger digit, say 8, is subtracted from a smaller digit, say 5, as shown below in decimal subtraction. Subtraction and Division

 For 10 minus 1, 1 is borrowed from the "tens" column for use in the "ones" column, leaving the "tens" column with only 2. The following examples show "borrowing" in binary subtraction. Subtraction and Division

 Binary division is almost as easy, and involves our knowledge of binary multiplication. Take for example the division of 1011 into 11. Subtraction and Division

 To check our answer, we first multiply our divisor 11 by our quotient 11. Then we add its' product to the remainder 10, and compare it to our dividend of The sum is equal to our initial dividend, therefore our solution is correct. Subtraction and Division

 Complements are used for storing numbers in the computer as well as for subtraction. In subtraction instead of calculating A - B we can add A to 1-complement of B plus 1 or by adding 2-complement of B to A. Unfortunately, this method needs a little bit more refining. Before we continue with it we first define complements of a binary number. One's and Two's Complements

 One's complement of a binary number A is a binary number obtained by subtracting each digit of A from 1. Alternatively, one's complement of a binary number A is a binary number such that: Each digit of A is changed into its opposite (i.e. 1 into 0, 0 into 1) One's and Two's Complements

 Example 1's complement of is Two's complement of a binary number A is a binary number obtained by adding 1 to one's complement of A. Example From the above example A is Then 1's compl. is 's compl. is One's and Two's Complements

 Any questions