Kavita Hatwal Fall 20021 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.

Slides:



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

Integers. Integer Storage Since Binary consists only of 0s and 1s, we can’t use a negative sign ( - ) for integers. Instead, the Most Significant Bit.
Binary Addition Rules Adding Binary Numbers = = 1
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Chapter 2 : Number System
Level ISA3: Information Representation
Assembly Language and Computer Architecture Using C++ and Java
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Chapter Chapter Goals Know the different types of numbers Describe positional notation.
Mathematics with Binary. Question  Below is a binary string  Which is the least significant bit (LSB)?  Which is the most significant bit (MSB)? 0.
Data Representation in Computers
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Chapter 02 Binary Values and Number Systems Nell Dale & John Lewis.
Number System and Codes
Number Systems Lecture 02.
Data Representation in Computers. Data Representation in Computers/Session 3 / 2 of 33 Number systems  The additive approach – Number earlier consisted.
© GCSE Computing Candidates should be able to:  convert positive denary whole numbers (0-255) into 8-bit binary numbers and vice versa  add two 8-bit.
The Binary Number System
Data Representation Number Systems.
ES 244: Digital Logic Design Chapter 1 Chapter 1: Introduction Uchechukwu Ofoegbu Temple University.
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.
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
Data Representation – Binary Numbers
Numbering Systems CS208.
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
Number Representation. 10/12/2015CDA31002 Conversion between Representations Now we can represent a quantity in different number representations How can.
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.
Chapter 2 Binary Values and Number Systems. 2 2 Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645,
Computer Arithmetic and the Arithmetic Unit Lesson 2 - Ioan Despi.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
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.
CSC 221 Computer Organization and Assembly Language
Lecture 2 Binary Values and Number Systems. The number 943 is an example of a number written in positional notation. The relative positions of the digits.
Operations on Bits Arithmetic Operations Logic Operations
THE BINARY SYSTEM.
AEEE2031 Data Representation and Numbering Systems.
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
07/12/ Data Representation Two’s Complement & Binary Arithmetic.
Addition and Substraction
SAK Chapter 21 Chapter 2 : Number System 2.1 Decimal, Binary, Octal and Hexadecimal Numbers 2.2 Relation between binary number system with other.
Introduction To Number Systems Binary System M. AL-Towaileb1.
IT1004: Data Representation and Organization Negative number representation.
Chapter 1 Number Systems Digital Electronics. Topics discussed in last lecture Digital systems Advantages of using digital signals over analog. Disadvantages.
Number Systems and Computer Arithmetic Winter 2014 COMP 1380 Discrete Structures I Computing Science Thompson Rivers University.
©2010 Cengage Learning SLIDES FOR CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION Click the mouse to move to the next page. Use the ESC key to exit.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
Computer Organization 1 Data Representation Negative Integers.
Lecture 2: 8/29/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
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.
Digital Logic & Design Adil Waheed Lecture 02.
NUMBER SYSTEMS.
Digital Logic & Design Dr. Waseem Ikram Lecture 02.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
COMPUTING FUNDAMENTALS
Number Systems Lab session 1 Xuan Guo.
Number Systems.
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
Digital Logic & Design Lecture 02.
Digital Electronics and Microprocessors
Number Representation
CPS120: Introduction to Computer Science
Chapter Four Data Representation in Computers By Bezawit E.
Binary to Decimal Conversion
Copyright © Cengage Learning. All rights reserved.
Presentation transcript:

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 are formed by combination of these 10 numbers -> to form a 2- digit number, the second digit is multiplied by is equal to (1 X 10) + 5. To form a 3-digit number, the third digit is multiplied by 100. This concept continues with the next digit multiplied by 1000, the next by 10,000, and so on. A number like 8679 would be calculated as (8 X 1000) + (6 X 100) + (7 X 10) + (9 X 1). Or More generally, decimal or base 10 notation is based on the fact that any positive integer can be written uniquely as sum of products of the form Where each n is a nonnegative integer (0 and above) and each d is one of the 10 digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 This concept is easy to grasp, because we use the decimal system in every day applications.

Kavita Hatwal Fall But the computers use base 2 or binary notation. The signals used in modern electronics are always in one of only two states->0,1. Just like in decimal any any positive integer can be written uniquely as sum of products of the form where 10 is the base Similarly in binary or base 2 notation, any positive integer can be written uniquely as sum of products of the form where 2 is the base Example

Kavita Hatwal Fall Converting binary to decimal = mutiply Add these to get the equivalent base 10 number

Kavita Hatwal Fall Converting decimal to binary To convert a base 10 number into base 2, repeatedly divide the number by 2 till the quotient is 0 and keep collecting the remainders at each step Divisor QuotientRemainder Collect these starting from the bottom So the binary equivalent of 35 is

Kavita Hatwal Fall Divisor QuotientRemainder Or reverse the position of quotient And then collect the remainders from top to bottom to get the binary equivalent of 35 which is

Kavita Hatwal Fall Binary addition Binary addition is similar to decimal addition in the sense that you start adding the addends proceeding from right to left. But the numbers that you’re allowed to use are only 0 and 1. Rules for binary addition 0+0 = = = = 0, carry over = 1, carry over 1 Add If the carry goes on beyond the maximum number of bits, then an overflow has occurred. Page 73, # 14

Kavita Hatwal Fall Negative number representation in binary notation Earlier it was decided to make the leftmost bit the sign bit ->1 denotes a negative number and 0 in that bit position indicates a positive number. So 6 = 0110 (in binary) and -6 = 1110 But this led to complications like if we add 6 and –6, we should get 0, but what do we get? Try it out To avoid this and many other complications like non unique representation of 0, adding a negative and a positive number etc, an easier way called the two’s complement was adopted in which leading 0’s means a positive number and leading 1’s means a negative number. So in two’s complement land, for a fixed 4-bit space, we read for negative integers Page 73, #25

Kavita Hatwal Fall To find the 8-bit two’s complement of a positive integer a that is at most 255 Write the 8-bit binary representation for a. Switch all the 1’s to 0’s and 0’s to 1’s Add 1 in binary notation. Page 74, # 21 Two’s complement is extra handy when representing negative integers and performing addition and subtraction on signed integers. The 8-bit binary representation for a This knowledge comes handy when we’ve to do subtraction or addition of two different signed numbers Convert both integers to their 8 bit representations. Add using binary addition Truncate any leading 1’s that occur in the rightmost (2^8) position. Convert the sum back to decimal form interpreting leading o’s as +ve and leading 1’s as -ve Page 73, # 31

Kavita Hatwal Fall Hexadecimal notation The cool thing about Hexadecimal (base 16) is that we save space writing long binary numbers and also it is very easy to convert from hexadecimal to binary, since almost all computer data are multiples of 4. Similarly in hexadecimal or base 16 notation, any positive integer can be written uniquely as sum of products of the form To convert from hexadecimal to binary and vice versa just remember table on page 71. Use that table to convert E0D into binary into hexadecimal E 0 D C 5 Juxtapose the results